ComponentsIconsGuidesExamplesGetting started
ComponentsIconsGuidesExamplesGetting started
GitHub repository

Theme Select

Colour-theme switcher: click to step to the next mode, hover for the full menu.

Attributes

NameTypeDefaultDescription
modesArray<string | ThemeSelectMode>['system', 'light', 'dark']The states to cycle through: "system,light,dark", a JSON array, or objects from script.
valuestring—The mode in effect. Assigning it selects that mode silently; select() and next() report the change.
menu'auto' | 'always' | 'never'autoWhen to offer the dropdown: auto (three or more modes), always, or never.
placementPlacementbottomPreferred placement of the menu (floating-ui names).
show-labelbooleanfalseShow the current mode's label beside its icon.
disabledbooleanfalseBlocks interaction and dims the control.
manualbooleanfalseDo not touch the document or storage; the host applies the theme itself from theme-change.
targetstring | HTMLElement | undefinedundefinedElement the scheme is written to, or the id of one. Defaults to <html>.
theme-attributestringdata-themeAttribute written on the target, data-theme by default.
storage-keystringc2n-themelocalStorage key the chosen mode is remembered under. Empty disables persistence.
open-delaynumber150Milliseconds the pointer must rest on the trigger before the menu opens.
close-delaynumber200Milliseconds the menu stays open after the pointer leaves, so it can be crossed into.
aria-labelstring—Accessible name of the trigger. Defaults to Theme: <current label>.

Slots

NameDescription
system-iconReplaces the built-in monitor icon of the system mode, in the trigger and in its menu row. Every mode takes its icon from <value>-icon, so a custom mode brings its own.
light-iconReplaces the built-in sun icon of the light mode.
dark-iconReplaces the built-in moon icon of the dark mode.
checkMark shown beside the selected row in the menu. Defaults to a check.

Events

NameTypeDescription
theme-changeCustomEvent<ThemeSelectChangeDetail>The scheme in effect changed: a mode was picked, or the OS preference moved while system was selected. detail.value is the mode, detail.theme the scheme it resolves to. Does not bubble; assigning value from script is silent.

CSS parts

Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.

NameDescription
triggerThe button that shows the current mode and advances to the next one.
iconThe icon box inside the trigger and inside every menu row.
labelThe trigger's text, rendered only with show-label.
menuThe dropdown surface.
menu-itemOne row of the dropdown.
checkMarker region containing the check slot or fallback beside the selected row.

CSS custom properties

Grouped by semantic target and state from --c2-component__target__state--property. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
c2-theme-select
--c2-theme-select--transition-durationtime150msIcon cross-fade and trigger colour change.
c2-theme-select > trigger
--c2-theme-select__trigger--sizepixel32pxHeight of the trigger, and its width while icon-only.
--c2-theme-select__trigger--padding-inlinepixel8pxSide padding, used only with show-label.
--c2-theme-select__trigger--gappixel8pxSpace between the icon and the label.
--c2-theme-select__trigger--border-radiusborder-radius8px
--c2-theme-select__trigger--borderborder1px solid transparent
--c2-theme-select__trigger--backgroundcolortransparent
--c2-theme-select__trigger--colorcolor#18181b
c2-theme-select > trigger > hover
--c2-theme-select__trigger__hover--backgroundcolor#f4f4f5
--c2-theme-select__trigger__hover--colorcolor—Falls back to the resting colour.
c2-theme-select > trigger > active
--c2-theme-select__trigger__active--backgroundcolor#e4e4e7
c2-theme-select > trigger > open
--c2-theme-select__trigger__open--backgroundcolor—Trigger fill while the menu is open; falls back to the hover fill.
c2-theme-select > trigger > focus
--c2-theme-select__trigger__focus--outlineoutline2px solid rgba(2, 101, 220, 0.4)
--c2-theme-select__trigger__focus--outline-offsetpixel2px
c2-theme-select > trigger > disabled
--c2-theme-select__trigger__disabled--opacityopacity0.38
c2-theme-select > icon
--c2-theme-select__icon--sizepixel16pxSide of the icon square, in the trigger and in the menu rows.
c2-theme-select > label
--c2-theme-select__label--font-sizefont-size14px
--c2-theme-select__label--font-weightfont-weight500
c2-theme-select > menu
--c2-theme-select__menu--backgroundcolor#ffffff
--c2-theme-select__menu--borderborder1px solid #e4e4e7
--c2-theme-select__menu--border-radiusborder-radius8px
--c2-theme-select__menu--box-shadowbox-shadow0 8px 24px rgba(24, 24, 27, 0.08)
--c2-theme-select__menu--paddingpixel4px
--c2-theme-select__menu--min-widthpixel148px
--c2-theme-select__menu--gappixel2pxSpace between rows.
--c2-theme-select__menu--offsetpixel6pxDistance between the trigger and the menu.
c2-theme-select > menu-item
--c2-theme-select__menu-item--gappixel8px
--c2-theme-select__menu-item--padding-blockpixel6px
--c2-theme-select__menu-item--padding-inlinepixel8px
--c2-theme-select__menu-item--border-radiusborder-radius6px
--c2-theme-select__menu-item--colorcolor#18181b
--c2-theme-select__menu-item--font-sizefont-size14px
--c2-theme-select__menu-item--font-weightfont-weight500
c2-theme-select > menu-item > hover
--c2-theme-select__menu-item__hover--backgroundcolor#f4f4f5
c2-theme-select > menu-item > selected
--c2-theme-select__menu-item__selected--colorcolorrgb(2, 101, 220)
--c2-theme-select__menu-item__selected--backgroundcolor—Fill of the selected row; transparent by default.
c2-theme-select > check
--c2-theme-select__check--sizepixel14px
--c2-theme-select__check--colorcolor—Falls back to the selected row's colour.
escAccordionConnected, animated panels with shared borders and single or multiple expansion.LayoutArea chartA line chart with the region under each line filled — every line-chart attribute, plus a fill opacity.ChartAttachmentFile and image attachments with metadata, upload progress, failure states, and actions.Data displayAutocompleteSearchable combobox for local or remote items with customizable list rows.InputsAvatarImage, initials or icon for a person, with status dot and badge.Data displayBadgeTinted pill for status text, counts and dots, optionally pinned to a corner of another element.Data displayBar chartBars over categories or time buckets, with several series drawn side by side within each band.ChartBorder BeamA decorative beam that travels around the border of any positioned container.LayoutBreadcrumbNavigation trail of link buttons with separators, a current page and optional collapsing.NavigationButtonThemeable button with slots for text, prefix, suffix and running icons.ButtonsButton GroupJoined actions and polished segmented controls with single or multiple selection.ButtonsCandlestick chartAn ECharts OHLC chart for market sessions and other open-close ranges, with semantic positive and negative colours.ChartCardGroups related content and actions on a single bordered surface.LayoutCascaderSelect a value from related, multi-level data in one floating panel.InputsChat InputAuto-growing message composer with keyboard submission, toolbar actions and native form support.ChatChat MessageFlexible message row for conversations, assistant answers and activity updates.ChatCheckboxNative checkbox behaviour in a quiet, themeable box with an opt-in hover layer.InputsCode EditorEditable, syntax-highlighted source field on CodeMirror 6, themed entirely through CSS variables.InputsCode ViewerSyntax-highlighted code with line numbers, copy button and dark mode, powered by shiki.Data displayColor AreaTwo-dimensional area for picking saturation and value of a colour.InputsColor SelectColour swatch that opens a full picker built from area and slider.InputsColor SliderHorizontal slider for choosing a hue from 0 to 360.InputsCopy ButtonButton that copies text to the clipboard — the element it sits in, another element by id, or a literal string.ButtonsDashboardGrid of resizable panes, dragged by the edges they share.LayoutDate InputForm-associated single-date input with native picker, constraints, helper text and error states.InputsDate SelectorAccessible one- or two-month calendar for choosing a date range.InputsDetailsCollapsible disclosure built on native details and summary.LayoutGauge chartA focused radial KPI gauge drawn by ECharts, with a configurable scale, progress arc and pointer.ChartHeaderArranges brand, navigation, actions and a mobile trigger in a reusable site shell.LayoutIcon ButtonRound, hoverable button wrapping a slotted SVG icon.ButtonsKbdKeyboard key label for shortcuts and command hints, with the semantics of the native kbd element.Data displayLabelCaption that names and activates the control referenced by its for attribute, with a required marker.InputsLine chartA line chart over a time or numeric x axis, drawn on canvas by uPlot, with series declared as children.ChartLink ButtonText-styled control for link and navigation actions, rendered as a real anchor or a button.NavigationListVertical list container with single or multiple selection.Data displayList ItemSelectable row with icon slots, used on its own or as the option of list and select.Data displayMenuCommands, links, checkboxes and submenus in a popover anchored to a trigger.NavigationModalDialog built on the native dialog element: focus trap, backdrop, Escape, title, body and footer.FeedbackNavigation MenuSite navigation bar whose triggers open panels of links below the header.NavigationNumber InputForm-associated numeric input with native validation, step controls, adornments and helper states.InputsOverlayAnchored popup built on the browser Popover API, positioned with floating-ui.FeedbackPaginationPage navigation in three layouts: numbered pages, a simple page status, or a table-footer row with rows-per-page.NavigationPie chartA pie or donut chart drawn by ECharts, where one row is one slice and label-field names it.ChartProgressLinear progress bar, indeterminate or filling to a value, with an optional label and count.FeedbackQR CodeGenerate accessible, themeable QR codes locally as crisp SVG graphics.Data displayQuestionnaireA multi-step single- and multiple-choice flow with validation, shortcuts and form submission.InputsRadar chartCompare several profiles across the same set of normalized indicators.ChartRadioRadio options built on native inputs, grouped into one value with keyboard navigation.InputsRateAccessible star rating input with hover preview, keyboard control and optional half values.InputsReorder ListReorder a vertical queue with pointer or keyboard input while the application owns persistence.Data displayScatter chartAn ECharts scatter plot for finding relationships, clusters and outliers across two numeric measures.ChartSelectDropdown that pairs a themeable trigger with an anchored list of c2-list-item options.InputsSeperatorHorizontal or vertical rule with an optional label, for dividing content and toolbars.LayoutSheetDialog pinned to an edge of the screen, for content that complements the page rather than interrupting it.FeedbackSide NavResponsive navigation drawer beside the page: pushes the content on large screens, slides over it with a backdrop on small ones.NavigationSkeletonPlaceholder block standing in for content that has not arrived, in three shapes and three animations.FeedbackSliderRange input with a themeable track, thumb, step ticks and value bubble.InputsSparklineA chromeless trend line sized for a table cell, a list row or the trend slot of a c2-stat.ChartSpinnerCircular progress indicator, indeterminate or showing a value, with optional text.FeedbackStatDisplays a KPI with an optional icon, trend and supporting description.Data displayStatus PanelCommunicate empty states, operation outcomes and recoverable errors with clear next steps.FeedbackStepsA vertical trace of a task as it runs: statuses, durations, and stages that open while they work and close when they are done.Data displaySwitchOn/off toggle on a native switch input, with label, description and thumb icons.InputsTableVirtualized data grid with declarative columns, sorting, selection, pinning and resizing.Data displayTabsTab strip that shows one content panel at a time.NavigationText FieldSingle-line input with icon slots, clear button, helper and error text, and a character counter.InputsTextareaMultiline text input with resizing, helper and error text, and a character counter.InputsTheme SelectColour-theme switcher: click to step to the next mode, hover for the full menu.InputsToastNotification cards and a manager for stacked, queued notifications with independent lifetimes.FeedbackTooltipContextual hint shown when its target is hovered or focused, rendered in the top layer.FeedbackTreeHierarchical tree view with expansion, selection, checkboxes and lazy loading.Data displayUploadDrag-and-drop file selection with validation, upload progress, retry, cancellation, and attachment results.InputsVirtual ListWindowed list with built-in search, sorting, selection and an async data source.Data displayFeather Icons287 open-source Feather icons, one web component each.IconsMat Icon2,234 Material Icons ligatures rendered through a single element.IconsPhosphor Icons1,512 flexible icons in six weights, one web component each.IconsThemingTheme every c2n component from a handful of design tokens with @c2n/theme, or reach for any component variable directly.GuideFrameworksUse the components from React, Vue, Angular, Svelte, Lit or plain HTML — typed events, generated template types, and the one piece of configuration each framework needs.GuideUsing c2n in an applicationThe workflow behind every c2n app: load the theme once, use c2-* tags directly, and turn every repeated pattern into a small variant or composed component.GuideAI toolsGive Claude Code, Codex or Google Antigravity the c2n skill, live component APIs, examples and application conventions.Guide