ComponentsIconsGuidesExamplesGetting started
ComponentsIconsGuidesExamplesGetting started
GitHub repository

Dashboard

Grid of resizable panes, dragged by the edges they share.

c2-dashboard

Grid of resizable panes. The children are c2-dash-card elements, placed by their col/row attributes; each one draws drag handles on the edges it shares with a neighbour, and dragging one resizes the whole track, so the cards on either side stay aligned. columns and rows take a track count (columns="3" is three equal columns) or an explicit track list (columns="320px 1fr"); a track is switched to pixels the first time it is dragged, and the fr tracks around it give up the space in proportion to their weight, down to the minimums. With a storage-key the sizes survive a reload.

layouts makes the grid responsive without a remount: each entry names a media query and the tracks and card placements to use while it matches, the first match wins, and every entry keeps its own stored sizes under <storage-key>@<media>. Stored payloads are versioned and include stable card order; serializeLayout and deserializeLayout can preserve application metadata such as named sizes without coupling it to the component.

Placement is the application's: the grid never re-places cards on its own. A pane removed or hidden at runtime leaves its cells empty and its neighbours where they were, and a pane added at runtime lands exactly where its col/row say, on top of whatever is already there if that cell is taken. To close a gap, or to make room, set the cards' col/row/col-span/row-span or hand the grid a layout record — both are applied in place.

The grid is the sizing authority: a card never sets its own width. Give the element a height (or place it in a flex/grid parent that does) whenever the rows use fr, since the row tracks divide the host's height.

Attributes

NameTypeDefaultDescription
columnsnumber | string | string[]2Column count (3) or an explicit track list ('320px 1fr'). Each entry must be one simple size.
rowsnumber | string | string[]1Row count (2) or an explicit track list ('auto 1fr').
min-column-widthnumber50Floor for every column, in pixels. A card's own min-width raises it for the tracks that card covers.
min-row-heightnumber50Floor for every row, in pixels. A card's own min-height raises it for the tracks that card covers.
storage-keystring | undefinedundefinedlocalStorage key the track sizes and stable card order are stored under. Without it the grid starts from the authored layout.

Slots

NameDescription
(default)The c2-dash-card panes. Anything else becomes an ordinary grid item, placed by your own CSS.

Events

NameTypeDescription
layout-changeCustomEvent<DashboardLayoutChangeDetail>The tracks or stable card order changed: a gesture ended, setPanelOrder()/reset() was called, or another entry of layouts took over. Includes the active breakpoint. Does not bubble: listen on the element.

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-dashboard
--c2-dashboard--gappixel8pxGutter between the cards. The whole gutter drags: each card's handle is centred on its edge and as thick as the gap (never under --c2-dash-card__handle--size).
--c2-dashboard--paddingpadding0pxInset around the tracks. With a background it is what turns the gutters into a visible frame between the panes.
--c2-dashboard--backgroundbackgroundtransparent
--c2-dashboard--borderbordernone
--c2-dashboard--border-radiusborder-radius0px

c2-dash-card

One pane of a c2-dashboard. It owns its place in the grid (col, row, col-span, row-span), the drag handles on the edges it shares with a neighbour, and the optional expand controls; it draws no surface of its own, so put a c2-card — or any markup — in the default slot.

A handle resizes the whole grid track, never just this card, and it only appears where there is a neighbour to take the space from: the right edge has one when another column follows, the left edge when one precedes. Drag it, or focus it and use the arrow keys (10px a step, 1px with Shift).

Filling the header, actions or footer slot turns on that row; with the header and actions both empty the expand controls float over the top-right corner of the pane instead. An expanded card covers its neighbours on an opaque --c2-dash-card__expanded--background (the theme's surface colour), while the card itself stays transparent at rest.

A card that arrives while the grid is already on screen fades and scales in; one that leaves — through the grid's layout record (visible: false) or through dismiss(), which removes the element once the animation has played — fades out the same way. Cards present at load do not animate, and prefers-reduced-motion turns both off.

Every built-in icon is a slot whose fallback is the default drawing, so a pane can use the host application's own icon set without giving up the behaviour.

Attributes

NameTypeDefaultDescription
card-idstring | undefinedundefinedIdentifier the grid's layout record is keyed by.
colnumber11-based column the card starts in.
rownumber11-based row the card starts in.
col-spannumber1Number of columns the card occupies.
row-spannumber1Number of rows the card occupies.
min-widthnumber0Smallest width in pixels the card accepts; it raises the minimum of every column it covers.
min-heightnumber0Smallest height in pixels the card accepts; it raises the minimum of every row it covers.
resizeDashCardResizebothWhich edges carry a drag handle.
expand-widthbooleanfalseOffers a control that expands the card across every column.
expand-heightbooleanfalseOffers a control that expands the card across every row.
expand-fullbooleanfalseOffers a control that expands the card over the whole grid.
expandedDashCardExpandednoneHow far the card is currently expanded. Settable, so an app can expand a card from its own control.

Slots

NameDescription
(default)Pane content. It fills the pane: the body is a column flex box and every slotted child is a flex: 1 item with min-height: 0, so a chart or an editor follows the row track without a height: 100% chain.
headerTitle area of the header row; filling it turns the row on.
actionsYour own controls at the end of the header row, before the built-in expand buttons and separated from them by --c2-dash-card__actions--gap.
controlsYour own controls inside the built-in group, immediately before the expand buttons — for a button that belongs with them, such as a refresh or a close.
footerStatus bar under the pane content; filling it turns the row on.
expand-width-iconIcon of the full-width control while the card is not expanded that way.
collapse-width-iconIcon of the full-width control while it is.
expand-height-iconIcon of the full-height control while the card is not expanded that way.
collapse-height-iconIcon of the full-height control while it is.
expand-full-iconIcon of the fullscreen control while the card is not expanded.
collapse-full-iconIcon of the fullscreen control while it is.

Events

NameTypeDescription
expand-changeCustomEvent<DashCardExpandChangeDetail>The card was expanded or collapsed through one of its own controls. Does not bubble: listen on the element.

CSS parts

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

NameDescription
headerConditional row containing the header and actions slots, or the floating controls when both are empty.
bodyThe wrapper around the default slot.
footerConditional row wrapping the assigned footer slot.
controlsComponent-owned group containing the controls slot and built-in expand-button fallbacks.
controlOne built-in expand button.
handleEvery drag handle. Each also carries the part of its edge.
handle-leftThe handle on the left edge.
handle-rightThe handle on the right edge.
handle-topThe handle on the top edge.
handle-bottomThe handle on the bottom edge.

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-dash-card
--c2-dash-card--backgroundbackgroundtransparent
--c2-dash-card--borderbordernone
--c2-dash-card--border-radiusborder-radius0px
--c2-dash-card--box-shadowbox-shadownone
--c2-dash-card--paddingpadding0px
--c2-dash-card--overflowoverflowhiddenhidden keeps the content inside the track; switch it to visible for a pane that has to overflow, such as one holding a menu.
c2-dash-card > expanded
--c2-dash-card__expanded--backgroundbackground#ffffffFill while the card is expanded over its neighbours, so they do not show through; the card's own background stays transparent.
--c2-dash-card__expanded--z-indexnumber20
--c2-dash-card__expanded--animation-durationduration200msLength of the scale-in the card plays when it expands or collapses. Ignored under prefers-reduced-motion.
c2-dash-card > enter
--c2-dash-card__enter--animation-durationduration200msFade and scale-in of a card added to a grid that is already on screen, or shown again through the layout record. 0ms disables it.
c2-dash-card > leave
--c2-dash-card__leave--animation-durationduration160msFade-out before a card is hidden by the layout record or removed by dismiss(). 0ms disables it.
c2-dash-card > header
--c2-dash-card__header--min-heightpixel44px
--c2-dash-card__header--padding-blockpadding8px
--c2-dash-card__header--padding-inlinepadding12px
--c2-dash-card__header--gappixel12px
--c2-dash-card__header--backgroundbackgroundtransparent
--c2-dash-card__header--border-bottombordernone
--c2-dash-card__header--colorcolor#18181b
--c2-dash-card__header--font-sizepixel14px
--c2-dash-card__header--font-weightfont-weight600
c2-dash-card > footer
--c2-dash-card__footer--min-heightpixel36px
--c2-dash-card__footer--padding-blockpadding6px
--c2-dash-card__footer--padding-inlinepadding12px
--c2-dash-card__footer--gappixel8px
--c2-dash-card__footer--backgroundbackgroundtransparent
--c2-dash-card__footer--border-topbordernone
--c2-dash-card__footer--colorcolor#71717a
--c2-dash-card__footer--font-sizepixel12px
c2-dash-card > actions
--c2-dash-card__actions--gappixel8px
c2-dash-card > controls
--c2-dash-card__controls--gappixel2px
--c2-dash-card__controls--offsetpixel4pxInset of the floating control group from the top-right corner, used only while the header row is off.
c2-dash-card > control
--c2-dash-card__control--sizepixel24px
--c2-dash-card__control--icon-sizepixel16px
--c2-dash-card__control--border-radiusborder-radius6px
--c2-dash-card__control--colorcolor#71717a
--c2-dash-card__control--backgroundbackgroundtransparent
c2-dash-card > control > hover
--c2-dash-card__control__hover--backgroundbackground#f4f4f5
--c2-dash-card__control__hover--colorcolor#18181b
c2-dash-card > control > focus
--c2-dash-card__control__focus--outlineoutline2px solid rgba(2, 101, 220, 0.4)
--c2-dash-card__control__focus--outline-offsetpixel2px
c2-dash-card > handle
--c2-dash-card__handle--sizepixel6pxSmallest thickness of the grab area on an edge. Inside a grid the handle is as thick as the gutter when that is wider, centred on the edge, so the whole gutter drags.
--c2-dash-card__handle--insetpixel2pxGap between the handle's visible bar and the ends of the edge.
--c2-dash-card__handle--backgroundbackgroundtransparent
--c2-dash-card__handle--border-radiusborder-radius999px
--c2-dash-card__handle--transition-durationduration150ms
c2-dash-card > handle > hover
--c2-dash-card__handle__hover--backgroundbackgroundrgba(2, 101, 220, 0.2)
c2-dash-card > handle > active
--c2-dash-card__handle__active--backgroundbackgroundrgb(2, 101, 220)
c2-dash-card > handle > focus
--c2-dash-card__handle__focus--outlineoutline2px solid rgba(2, 101, 220, 0.4)
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