Skip to content
ray·elements
Get startedFoundationsComponentsExtendingChartsraylang

Buttons

Inputs

Navigation

Overlays

Data display

Feedback

Layout

Theme

Buttons

Button Button group Icon button Toggle Toggle group

Inputs

Avatar picker (Profile picture, Photo picker) Checkbox Checkbox group Color picker Combobox (Multi select) Date picker File upload Image crop Input Knob (Rotary, Dial, Potentiometer) Mode input Number input Password input Path input (File path, Folder picker) Radio group Search Segmented control Select Slider (Range, Fader) Switch Tags input (Tag input, Chips input, TagsInput) Textarea

Navigation

Bottom nav Breadcrumbs Document tabs Nav link Pagination Sidebar Stepper Tabs

Overlays

Command palette Dialog (Modal) Drawer Menu Popover Tooltip

Data display

Accordion Attachment Avatar Badge Blockquote Carousel Code Icon Indicator Kbd Meter (Level meter, VU meter, Peak meter) QR code (QR, Barcode, 2D code) Stat Table Timeline

Feedback

Alert Empty state Notification Progress Pulse Ring progress Skeleton Spinner Step dots

Layout

App bar App shell Aspect ratio Card Center Container Grid Group Scroll area Separator Split Stack Status bar

Theme

Theme toggle
Components/Navigation

Sidebar

The side navigation of an app shell: header, content and footer; on wide screens it collapses to an icon rail (or out of view), below a breakpoint it becomes an off-canvas drawer. toggle() does the right thing for the screen. It is for navigation, a list of places with icons; for content such as a tree of documents, a panel that hides and resizes, put your own element in a pane of a ray-split (the start pane, or the end pane with fixed="end" for an inspector; min, max, autosave, collapsed).

Source on GitHub

ray-remote
3
Files
The button collapses the sidebar to icons, or out of view with collapse="offcanvas"; its edge drags it wider (resizable); on a narrow screen it opens it as a drawer.
Code

Open the code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-sidebar>

Put ray-sidebar-group + ray-nav-link (with an icon in slot=left) inside. Collapsed, nav links show only their icon (the label becomes the tooltip) and the host has the collapsed attribute, so your own header/footer content can hide with CSS (ray-sidebar[collapsed] .brand-name { display: none }).

PropertyAttributeTypeDefaultDescription
collapsedcollapsed reflectsbooleanWide screens: collapsed as collapse says (an icon rail, or out of view).
collapsecollapse reflectsicon | offcanvasiconWhat collapsed does on wide screens: icon, a rail of the nav links' icons; offcanvas, hidden entirely (no width, out of the tab order).
openopen reflectsbooleanNarrow screens: the drawer is shown (modal, focus trapped; Escape, backdrop click or a followed link close it).
sideside reflectsstart | end | left | rightstartThe edge it sits on (its border faces the content, its narrow-screen drawer slides from there): start/end follow the writing direction; left/right are sides of the screen.
variantvariant reflectssidebar | floatingsidebarA panel against the edge, or a floating card with a margin.
widthwidthstringWidth when expanded (CSS length). Default 16rem.
collapsedWidthcollapsed-widthstringWidth of the icon rail. Default 3.5rem.
breakpointbreakpointstring48emAt this viewport width and below, it becomes a drawer.
labellabelstringSidebar (text sidebar.label)Accessible name of its navigation.
resizableresizable reflectsbooleanWide screens, expanded: its inner edge drags (or, focused, arrow-keys; Shift is faster, Home/End go to the limits) the width between min-width and max-width.
minWidthmin-widthnumber192Narrowest width when resizing, in px.
maxWidthmax-widthnumber480Widest width when resizing, in px.
autosaveautosavestringA key: the resized width is saved in localStorage and restored. A later change of width wins.
resizeLabelresize-labelstringResize sidebar (text sidebar.resize)Accessible name of the resize edge.
EventDescription
ray-resizeAfter a drag or a key resized it (resizable).
ray-toggleAfter toggle().
ray-openThe drawer opened (narrow screens).
ray-closeThe drawer closed (narrow screens).
SlotDescription
(default)The navigation: ray-sidebar-group and ray-nav-link elements.
headerTop area (brand, workspace switcher).
footerBottom area (user, settings).
PartDescription
panelThe panel (in the drawer on narrow screens).
headerThe header area.
contentThe scrolling <nav>.
footerThe footer area.
resizerThe resize edge (a separator), shown when resizable.
drawerThe <dialog> used on narrow screens.

<ray-sidebar-group>

A titled section of nav links; the title fades out (keeping its height) when the sidebar collapses.

PropertyAttributeTypeDefaultDescription
labellabelstringSection title.
SlotDescription
(default)ray-nav-link elements.
PartDescription
labelThe title.
itemsThe links container.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
sidebar.labelSidebar
sidebar.resizeResize sidebar
PreviousPaginationNextStepper
ray·elements — web components for any app, with raylang extras GitHub · npm · Changelog · License For AI agents: llms.txt · llms-full.txt Tokens, docs, tests and wrappers generated by tools/run.sh build