100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.

0 downloads

dbbasic-web-native/test-tabs.html
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web-native.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web-native.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web-native.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add canonical.html v1.0 - The single source of truth for usability standards fb6e650 1 year ago History
test-tabs.html · 5.5 KB · 181 lines
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Semantic Tabs Test</title>
7 <script src="semantic-components.js"></script>
8 <style>
9 body {
10 background: #000;
11 color: #fff;
12 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
13 padding: 40px;
14 max-width: 1200px;
15 margin: 0 auto;
16 }
17
18 h1 {
19 margin-bottom: 40px;
20 }
21
22 .demo-section {
23 margin-bottom: 60px;
24 }
25
26 .demo-section h2 {
27 font-size: 20px;
28 color: #8e8e93;
29 margin-bottom: 20px;
30 }
31
32 tab-panel {
33 color: #fff;
34 }
35
36 tab-panel h3 {
37 margin-top: 0;
38 color: #409cff;
39 }
40
41 tab-panel p {
42 line-height: 1.6;
43 color: #ababab;
44 }
45 </style>
46</head>
47<body>
48 <h1>semantic-tabs Component Test</h1>
49
50 <div class="demo-section">
51 <h2>Basic Tabs</h2>
52 <semantic-tabs>
53 <tab-item label="Overview"></tab-item>
54 <tab-item label="Features"></tab-item>
55 <tab-item label="Pricing"></tab-item>
56
57 <tab-panel>
58 <h3>Overview</h3>
59 <p>Welcome to our semantic tabs component! This tab system provides a clean, accessible interface for organizing content.</p>
60 <p>Try clicking the other tabs or using arrow keys to navigate.</p>
61 </tab-panel>
62
63 <tab-panel>
64 <h3>Features</h3>
65 <p>✓ Keyboard navigation (Arrow keys, Home, End)</p>
66 <p>✓ WCAG AAA compliant</p>
67 <p>✓ Smooth transitions</p>
68 <p>✓ Badge support</p>
69 <p>✓ Disabled state support</p>
70 </tab-panel>
71
72 <tab-panel>
73 <h3>Pricing</h3>
74 <p>Free tier: $0/month - Perfect for getting started</p>
75 <p>Pro tier: $29/month - Advanced features and support</p>
76 <p>Enterprise: Custom pricing - Full customization and dedicated support</p>
77 </tab-panel>
78 </semantic-tabs>
79 </div>
80
81 <div class="demo-section">
82 <h2>Tabs with Badges</h2>
83 <semantic-tabs>
84 <tab-item label="Inbox" badge="12"></tab-item>
85 <tab-item label="Sent"></tab-item>
86 <tab-item label="Drafts" badge="3"></tab-item>
87 <tab-item label="Spam" badge="47"></tab-item>
88
89 <tab-panel>
90 <h3>Inbox</h3>
91 <p>You have 12 new messages waiting for you.</p>
92 </tab-panel>
93
94 <tab-panel>
95 <h3>Sent</h3>
96 <p>Your sent messages appear here.</p>
97 </tab-panel>
98
99 <tab-panel>
100 <h3>Drafts</h3>
101 <p>3 draft messages saved.</p>
102 </tab-panel>
103
104 <tab-panel>
105 <h3>Spam</h3>
106 <p>47 spam messages filtered.</p>
107 </tab-panel>
108 </semantic-tabs>
109 </div>
110
111 <div class="demo-section">
112 <h2>Tabs with Disabled State</h2>
113 <semantic-tabs selected="1">
114 <tab-item label="Active 1"></tab-item>
115 <tab-item label="Active 2"></tab-item>
116 <tab-item label="Disabled" disabled></tab-item>
117 <tab-item label="Active 3"></tab-item>
118
119 <tab-panel>
120 <h3>Active Tab 1</h3>
121 <p>This tab is active and clickable.</p>
122 </tab-panel>
123
124 <tab-panel>
125 <h3>Active Tab 2</h3>
126 <p>This tab starts selected (selected="1").</p>
127 </tab-panel>
128
129 <tab-panel>
130 <h3>Disabled Tab</h3>
131 <p>You shouldn't be able to see this!</p>
132 </tab-panel>
133
134 <tab-panel>
135 <h3>Active Tab 3</h3>
136 <p>Another active tab.</p>
137 </tab-panel>
138 </semantic-tabs>
139 </div>
140
141 <div class="demo-section">
142 <h2>Event Handling</h2>
143 <semantic-tabs id="event-tabs">
144 <tab-item label="Tab 1"></tab-item>
145 <tab-item label="Tab 2"></tab-item>
146 <tab-item label="Tab 3"></tab-item>
147
148 <tab-panel>
149 <h3>Tab 1 Content</h3>
150 <p>Content for tab 1</p>
151 </tab-panel>
152
153 <tab-panel>
154 <h3>Tab 2 Content</h3>
155 <p>Content for tab 2</p>
156 </tab-panel>
157
158 <tab-panel>
159 <h3>Tab 3 Content</h3>
160 <p>Content for tab 3</p>
161 </tab-panel>
162 </semantic-tabs>
163 <div id="event-log" style="margin-top: 20px; padding: 12px; background: #1c1c1e; border-radius: 8px; font-family: monospace; font-size: 13px;">
164 <div style="color: #8e8e93; margin-bottom: 8px;">Event Log:</div>
165 <div id="log-output" style="color: #409cff;"></div>
166 </div>
167 </div>
168
169 <script>
170 // Event handling demo
171 const eventTabs = document.getElementById('event-tabs');
172 const logOutput = document.getElementById('log-output');
173
174 eventTabs.addEventListener('tab-change', (e) => {
175 const time = new Date().toLocaleTimeString();
176 const label = e.detail.tab ? e.detail.tab.getAttribute('label') : 'Unknown';
177 logOutput.innerHTML = `[${time}] Tab changed to: ${label} (index: ${e.detail.index})`;
178 });
179 </script>
180</body>
181</html>