askrobots / dbbasic-web-native
Public
100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
danq9
Add canonical.html v1.0 - The single source of truth for usability standards
fb6e650
1 year ago
History
semantic-list.html · 7.0 KB · 155 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-list - Semantic Components</title> |
| 7 | <script src="../semantic-components.js"></script> |
| 8 | <link rel="stylesheet" href="component-docs.css"> |
| 9 | </head> |
| 10 | <body> |
| 11 | <div class="container"> |
| 12 | <!-- Header --> |
| 13 | <div class="header"> |
| 14 | <h1 class="component-name"><semantic-list></h1> |
| 15 | <p class="tagline">Selectable lists with keyboard navigation and ARIA support</p> |
| 16 | <div class="quick-example"> |
| 17 | <semantic-list selectable> |
| 18 | <list-item>First Item</list-item> |
| 19 | <list-item>Second Item</list-item> |
| 20 | <list-item aria-selected="true">Selected Item</list-item> |
| 21 | </semantic-list> |
| 22 | </div> |
| 23 | </div> |
| 24 | |
| 25 | <!-- Overview --> |
| 26 | <section class="section"> |
| 27 | <h2 class="section-title">Overview</h2> |
| 28 | <p class="section-description">The semantic-list component displays items in a vertical list with optional selection. Lists automatically handle keyboard navigation (arrow keys), focus management, and multi-select when enabled.</p> |
| 29 | </section> |
| 30 | |
| 31 | <!-- Examples --> |
| 32 | <section class="section"> |
| 33 | <h2 class="section-title">Examples</h2> |
| 34 | <div class="grid"> |
| 35 | |
| 36 | <div class="example"> |
| 37 | <div class="example-label">Selectable List</div> |
| 38 | <div class="example-demo"> |
| 39 | <semantic-list selectable> |
| 40 | <list-item>First Item</list-item> |
| 41 | <list-item>Second Item</list-item> |
| 42 | <list-item aria-selected="true">Selected Item</list-item> |
| 43 | </semantic-list> |
| 44 | </div> |
| 45 | <div class="example-code"><semantic-list selectable> |
| 46 | <list-item>First Item</list-item> |
| 47 | <list-item>Second Item</list-item> |
| 48 | <list-item aria-selected="true">Selected Item</list-item> |
| 49 | </semantic-list></div> |
| 50 | <div class="example-notes">Use for: Option selection, file lists, settings<br>Keyboard: Arrow keys navigate, Space/Enter select<br>Accessibility: ARIA selection states announced</div> |
| 51 | </div> |
| 52 | </div> |
| 53 | </section> |
| 54 | |
| 55 | <!-- Interactive States --> |
| 56 | <section class="section"> |
| 57 | <h2 class="section-title">Interactive States</h2> |
| 58 | <div class="state-showcase"> |
| 59 | |
| 60 | <div class="state-box"> |
| 61 | <div class="state-label">Default State</div> |
| 62 | <div class="state-visual state-default"> |
| 63 | <semantic-list intent="primary" >Default</semantic-list> |
| 64 | </div> |
| 65 | <div class="state-description">Grey borders, dark background</div> |
| 66 | </div> |
| 67 | <div class="state-box"> |
| 68 | <div class="state-label">Hover (selectable) State</div> |
| 69 | <div class="state-visual state-hover (selectable)"> |
| 70 | <semantic-list intent="primary" >Hover (selectable)</semantic-list> |
| 71 | </div> |
| 72 | <div class="state-description">Blue border highlight</div> |
| 73 | </div> |
| 74 | <div class="state-box"> |
| 75 | <div class="state-label">Selected State</div> |
| 76 | <div class="state-visual state-selected"> |
| 77 | <semantic-list intent="primary" >Selected</semantic-list> |
| 78 | </div> |
| 79 | <div class="state-description">Blue border, blue background tint</div> |
| 80 | </div> |
| 81 | <div class="state-box"> |
| 82 | <div class="state-label">Focus State</div> |
| 83 | <div class="state-visual state-focus"> |
| 84 | <semantic-list intent="primary" >Focus</semantic-list> |
| 85 | </div> |
| 86 | <div class="state-description">Blue outline for keyboard navigation</div> |
| 87 | </div> |
| 88 | </div> |
| 89 | </section> |
| 90 | |
| 91 | <!-- Properties --> |
| 92 | <section class="section"> |
| 93 | <h2 class="section-title">Properties & Attributes</h2> |
| 94 | <table class="property-table"> |
| 95 | <thead> |
| 96 | <tr> |
| 97 | <th>Attribute</th> |
| 98 | <th>Type</th> |
| 99 | <th>Values</th> |
| 100 | <th>Default</th> |
| 101 | <th>Description</th> |
| 102 | </tr> |
| 103 | </thead> |
| 104 | <tbody> |
| 105 | |
| 106 | <tr style="border-bottom: 1px solid #333;"> |
| 107 | <td style="padding: 12px;"><span class="prop-name">type</span></td> |
| 108 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 109 | <td style="padding: 12px;"><span class="prop-values">default | compact | spacious</span></td> |
| 110 | <td style="padding: 12px;">default</td> |
| 111 | <td style="padding: 12px;">Visual density of list items</td> |
| 112 | </tr> |
| 113 | <tr style="border-bottom: 1px solid #333;"> |
| 114 | <td style="padding: 12px;"><span class="prop-name">selectable</span></td> |
| 115 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 116 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 117 | <td style="padding: 12px;">false</td> |
| 118 | <td style="padding: 12px;">Whether items can be selected</td> |
| 119 | </tr> |
| 120 | |
| 121 | <tr style="border-bottom: 1px solid #333;"> |
| 122 | <td style="padding: 12px;"><span class="prop-name">default</span></td> |
| 123 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 124 | <td style="padding: 12px;">list-item elements</td> |
| 125 | </tr> |
| 126 | </tbody> |
| 127 | </table> |
| 128 | </section> |
| 129 | |
| 130 | <!-- Events --> |
| 131 | <section class="section"> |
| 132 | <h2 class="section-title">Events</h2> |
| 133 | <table class="property-table"> |
| 134 | <thead> |
| 135 | <tr> |
| 136 | <th>Event</th> |
| 137 | <th>Trigger</th> |
| 138 | <th>Detail</th> |
| 139 | <th>Description</th> |
| 140 | </tr> |
| 141 | </thead> |
| 142 | <tbody> |
| 143 | |
| 144 | <tr style="border-bottom: 1px solid #333;"> |
| 145 | <td style="padding: 12px;"><span class="prop-name">select</span></td> |
| 146 | <td style="padding: 12px;">Item clicked (when selectable)</td> |
| 147 | <td style="padding: 12px;"><code>{ item, index }</code></td> |
| 148 | <td style="padding: 12px;">Item selection event</td> |
| 149 | </tr> |
| 150 | </tbody> |
| 151 | </table> |
| 152 | </section> |
| 153 | </div> |
| 154 | </body> |
| 155 | </html> |