J3W1 / DESIGN SYSTEM
Menu
A menu button that opens a list of actions on the raised surface inside a 1px overlay border; the active item is the selection fill and check items show a glyph.
stable · LIGHT DOM · 1.1.0
Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.
Live variants
default
<j3w1-menu id="example-menu-default"><div class="menu">
<button class="menu-button" type="button" id="example-menu-default-menu-file-button" aria-haspopup="menu" aria-expanded="true" aria-controls="example-menu-default-menu-file">File<span class="menu-chevron" aria-hidden="true"><svg viewBox="0 0 16 16" width="12" height="12" focusable="false"><path d="M4 6l4 4 4-4"></path></svg></span></button>
<ul class="menu-list" role="menu" id="example-menu-default-menu-file" aria-labelledby="example-menu-default-menu-file-button">
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="0"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">New window</span><span class="menu-shortcut">Mod+Enter</span></button></li>
<li role="none"><button class="menu-item menu-item-demo-target" role="menuitem" type="button" tabindex="-1"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Open…</span><span class="menu-shortcut">Mod+O</span></button></li>
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="-1" aria-disabled="true"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Save</span><span class="menu-shortcut">Mod+S</span></button></li>
<li class="menu-separator" role="separator"></li>
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="-1"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Quit</span><span class="menu-shortcut">Mod+Shift+Q</span></button></li>
</ul>
</div></j3w1-menu>with-submenu
<j3w1-menu id="example-menu-with-submenu"><div class="menu">
<button class="menu-button" type="button" id="example-menu-with-submenu-menu-view-button" aria-haspopup="menu" aria-expanded="true" aria-controls="example-menu-with-submenu-menu-view">View<span class="menu-chevron" aria-hidden="true"><svg viewBox="0 0 16 16" width="12" height="12" focusable="false"><path d="M4 6l4 4 4-4"></path></svg></span></button>
<ul class="menu-list" role="menu" id="example-menu-with-submenu-menu-view" aria-labelledby="example-menu-with-submenu-menu-view-button">
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="0"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Reload</span><span class="menu-shortcut">Mod+R</span></button></li>
<li role="none"><button class="menu-item menu-item-demo-target" role="menuitem" type="button" tabindex="-1" aria-haspopup="menu" aria-expanded="false" aria-controls="example-menu-with-submenu-submenu-0" id="example-menu-with-submenu-submenu-0-trigger"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Density</span><span class="menu-submenu" aria-hidden="true"><svg viewBox="0 0 16 16" width="12" height="12" focusable="false"><path d="M6 4l4 4-4 4"></path></svg></span></button><ul class="menu-list" role="menu" id="example-menu-with-submenu-submenu-0" aria-labelledby="example-menu-with-submenu-submenu-0-trigger" hidden=""><li role="none"><button class="menu-item" type="button" role="menuitemradio" aria-checked="true" tabindex="-1" data-action="submenu-0:first">First option</button></li><li role="none"><button class="menu-item" type="button" role="menuitemradio" aria-checked="false" tabindex="-1" data-action="submenu-0:second">Second option</button></li></ul></li>
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="-1" aria-haspopup="menu" aria-expanded="false" aria-controls="example-menu-with-submenu-submenu-1" id="example-menu-with-submenu-submenu-1-trigger"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Profile</span><span class="menu-submenu" aria-hidden="true"><svg viewBox="0 0 16 16" width="12" height="12" focusable="false"><path d="M6 4l4 4-4 4"></path></svg></span></button><ul class="menu-list" role="menu" id="example-menu-with-submenu-submenu-1" aria-labelledby="example-menu-with-submenu-submenu-1-trigger" hidden=""><li role="none"><button class="menu-item" type="button" role="menuitemradio" aria-checked="true" tabindex="-1" data-action="submenu-1:first">First option</button></li><li role="none"><button class="menu-item" type="button" role="menuitemradio" aria-checked="false" tabindex="-1" data-action="submenu-1:second">Second option</button></li></ul></li>
<li class="menu-separator" role="separator"></li>
<li role="none"><button class="menu-item" role="menuitem" type="button" tabindex="-1"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Full screen</span><span class="menu-shortcut">F11</span></button></li>
</ul>
</div></j3w1-menu>with-checks
<j3w1-menu id="example-menu-with-checks"><div class="menu">
<button class="menu-button" type="button" id="example-menu-with-checks-menu-options-button" aria-haspopup="menu" aria-expanded="true" aria-controls="example-menu-with-checks-menu-options">Options<span class="menu-chevron" aria-hidden="true"><svg viewBox="0 0 16 16" width="12" height="12" focusable="false"><path d="M4 6l4 4 4-4"></path></svg></span></button>
<ul class="menu-list" role="menu" id="example-menu-with-checks-menu-options" aria-labelledby="example-menu-with-checks-menu-options-button">
<li role="none"><button class="menu-item" role="menuitemcheckbox" type="button" tabindex="0" aria-checked="true"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Line numbers</span></button></li>
<li role="none"><button class="menu-item menu-item-demo-target" role="menuitemcheckbox" type="button" tabindex="-1" aria-checked="false"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Wrap lines</span></button></li>
<li role="none"><button class="menu-item" role="menuitemcheckbox" type="button" tabindex="-1" aria-checked="true"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Render whitespace</span></button></li>
<li class="menu-separator" role="separator"></li>
<li role="none"><button class="menu-item" role="menuitemcheckbox" type="button" tabindex="-1" aria-checked="false" aria-disabled="true"><span class="menu-check" aria-hidden="true">✓</span><span class="menu-label">Minimap</span></button></li>
</ul>
</div></j3w1-menu>Install and register
Use the exact version. If npm publication is pending, install the release tarball from the installation guide.
npm install --save-exact @j3w1/ui@1.1.0import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/menu.css';
import '@j3w1/ui/register/menu';Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.
Copy the complete implementation
npx --package=@j3w1/ui@1.1.0 j3w1-ui copy menu --out ./vendor/j3w1/menuThe CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.
Public API
attributes
| Name | Type / signature | Meaning |
|---|---|---|
disabled | CustomEvent | Disable the native controls owned by this instance. |
loading | CustomEvent | Mark the primary control busy and prevent duplicate activation. |
properties
| Name | Type / signature | Meaning |
|---|---|---|
disabled | boolean | Delegates disabled state to native children. |
name | string | Native control name; application form keys remain explicit. |
open | boolean | Menu visibility. |
methods
| Name | Type / signature | Meaning |
|---|---|---|
refresh | (): void | Reconnect behavior after replacing native child structure. |
focus | (options?: FocusOptions): void | Focus the first usable native control. |
show | (): void | Open and focus the first menu item. |
hide | (focus?: boolean): void | Close all menus, optionally restoring the trigger. |
events
| Name | Type / signature | Meaning |
|---|---|---|
j3w1-action | CustomEvent | An enabled action or check item was invoked. |
Dependencies and verification
Registered components: none. Style dependencies: none.
Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.
Full implementation manifest, API and token dependency closure