OverviewGetting startedComponentsIconsGuidesExamples
OverviewGetting startedComponentsIconsGuidesExamples
GitHub repositoryJoin the c2n-webcomponents Discord

Table

Virtualized data grid with declarative columns, sorting, selection, pinning and resizing.

c2-table is one CSS grid: the header row and every body row are grid items using grid-template-columns: subgrid, so columns stay aligned without any scroll syncing, pinned columns are sticky cells instead of separate containers, and the whole body scrolls in a single viewport. Columns are declared either as c2-table-column children — definitions that render nothing themselves, the same way c2-select reads its c2-list-item children — or as a columns array of the same shape.

Rows and columns are both readable from markup as JSON and from script as properties, so a table can be authored without a build step. Past virtual-threshold rows (100 by default) the body is windowed to the visible range, and an async dataSource loads blocks of rows as they scroll into view — a million rows cost the same DOM as twenty.

Give the host a height (or --c2-table--max-height); the header stays sticky while the rows scroll under it. Tab moves into the header, the arrow keys walk cells, Enter sorts the focused column, Space selects the focused row and shift-click selects a range.

Import

import '@c2n/components/table'

The entry also registers c2-checkbox and c2-spinner, which it renders internally.

Usage

Put one c2-table-column per column in the default slot, and hand the table its rows. sortable on the table makes every column sortable; format runs the value through Intl; renderCell (a property) replaces a cell body with any markup.

Columns as data

columns takes the same fields as c2-table-column, as an array. Use it when the columns are computed rather than authored — a user-configurable grid, a response that decides its own shape, or a framework template that already holds them in state. It is a JSON attribute as well as a property, so the row above has no script behind it:

<c2-table sortable row-key="id" columns='[{"field":"name","header":"Name","width":"2fr","minWidth":140}]' rows="..."></c2-table>

From script the array can carry the things an attribute cannot — renderCell, renderHeader and comparator:

import { html } from 'lit'
import type { TableColumnConfig } from '@c2n/components/table'

const columns: TableColumnConfig[] = [
  { field: 'name', header: 'Name', width: '2fr' },
  { field: 'score', header: 'Score', width: '110px', align: 'end', format: 'number' },
  {
    field: 'status',
    header: 'Status',
    width: '120px',
    renderCell: ({ value }) => html`<c2-badge tone=${value === 'active' ? 'success' : 'warning'}>${value}</c2-badge>`,
  },
]

table.columns = columns

The two ways are exclusive per table, not merged: c2-table-column children win whenever there are any, so columns is the fallback and never a way to patch a child. With neither, the table derives one column per key of the first row, which is enough to look at a response before deciding how to present it.

Selecting rows: row keys

Selection names a row by its key, and so do value, the selection-change and row-click details and the range-change rows. The key is the row’s row-key field as a string — with row-key="id", { "id": 7 } is the row "7" — or whatever getRowKey(row) returns, for a key no single field holds. value stores strings, so table.value = [7, 8] and value="7;8" select the same two rows.

table.rowKey = 'id'
table.value = [7, 8] // stored as ['7', '8']

table.getRowKey = (row) => `${row.region}:${row.sku}` // wins over row-key

table.selectRows([order]) // by row: no key to rebuild
table.selectRows(more, { add: true })
table.deselectRows([order])
table.isSelected(order) // → false
table.keyOf(order) // → 'eu:A-100'

A click selects a row on its own, and clicking the row that is already the whole selection clears it again; ⌘/Ctrl-click and Space toggle one row in and out of a multiple selection, and shift-click selects a range.

Always set a key on a selectable table. Without one a row’s key is its position in the sorted rows — "0", "1", … — so a sort, a filter or a new rows array hands the selection to whichever rows now sit there. The table warns about it once in the console. selectRows() and deselectRows() fire selection-change, like selectAll().

Opening a row: row-activate

A table used for navigation — each row leads to a detail page — listens for row-activate. It fires for a pointer click on a row and for Enter on a focused body cell, so one listener serves the mouse and the keyboard alike; row-click stays pointer-only. Its detail is the row-click one (row, rowIndex, key). A click or Enter that belongs to a control inside a cell (a button, link or input) does not activate the row, and Space never does. In a selectable table it fires before the selection is applied, so a click or Enter both selects and activates.

row-activate does not bubble: a table nested in another table’s cell would otherwise open the outer row as well. Put the listener on the table itself.

table.addEventListener('row-activate', (event) => {
  location.href = `/services/${event.detail.key}`
})

Naming the table

Name the table the way you would any grid: aria-label, or aria-labelledby pointing at a heading. Both are read from the host and handed to the grid inside the shadow root, and follow later changes. An id cannot be resolved across the shadow boundary, so with aria-labelledby the grid is named after the referenced elements’ text.

<h2 id="services-heading">Services</h2>
<c2-table aria-labelledby="services-heading" row-key="id"></c2-table>

Totals: the summary row

A column with a summary gets a figure in a totals row below the body: sum, avg, min, max, count (the rows whose value is not empty), or a function of the rows from script. The row belongs to the same grid as the header and the body, so a figure stays under its own column whatever the order, width or pinning, is formatted with the column’s format (a count is always a plain number), and is kept at the bottom of the viewport while the rows scroll. The cell takes the column’s align; summary-align overrides it for the summary alone.

<c2-table row-key="id" rows="...">
  <c2-table-column field="task" header="Task" summary-label="Total" summary-span="2"></c2-table-column>
  <c2-table-column field="team" header="Team"></c2-table-column>
  <c2-table-column field="hours" header="Hours" align="end" format="number" summary="sum"></c2-table-column>
  <c2-table-column field="amount" header="Amount" align="end" format="currency" summary="sum"></c2-table-column>
</c2-table>

Figures are keyed by the column’s id, which is its field unless you give it one — column-id on the element, id in columns. Give one whenever two columns show the same field (an amount and its share of the total), or a computed column has no field at all; widths, pinning and the cell-<id> parts follow the id as well. It is not the HTML id, which would have to be unique in the whole page rather than in one table.

Aggregates cover every row; summary-scope="page" limits them to the page on show. A dataSource only holds the blocks it has fetched, so the table does not total it (except one loaded page with summary-scope="page"). Hand it the server’s figures instead — summaryValues sets a column’s figure outright, and wins over its aggregate:

const { rows, total, totals } = await api.orders({ start, count })
table.summaryValues = { amount: totals.amount, qty: totals.qty }

renderSummary renders the cell from { column, rows, value } like renderCell does a body cell. Style the row with --c2-table__summary--{height,background,color,font-size,font-weight,box-shadow}, and one figure with ::part(summary-content-<id>). The row is hidden while the table is empty, loading its first rows or showing an error.

Grouping rows

group-by gathers the rows into collapsible groups, outermost level first, and turns the grid into a treegrid. With the default group-display="row" a group is a row of the same grid: its label and row count in the first column (or the one marked group-column, which also indents the rows under it), and under every column with a summary that aggregate over the group’s rows, formatted like the column. So one summary="sum" gives the subtotals and the total. group-display="band" draws a full-width band per group instead, holding its label and count.

<c2-table row-key="id" group-by="region,status" selection="multiple" checkbox-selection rows="...">
  <c2-table-column field="customer" header="Customer" summary-label="Total"></c2-table-column>
  <c2-table-column field="region" header="Region" hidden></c2-table-column>
  <c2-table-column field="amount" header="Amount" align="end" format="currency" summary="sum"></c2-table-column>
</c2-table>

Groups are ordered by their value: ascending, the direction the table is sorted by that field, or a level’s own sort. The rows inside a group keep the table’s sort. A group’s label is its value formatted by the column of that field (hidden columns included), empty-group-label for rows without one, and renderGroup or a slot="group:<key>" child for anything else. From script a level can compute its value:

table.groupBy = [{ field: 'month', getValue: (row) => String(row.placed).slice(0, 7), sort: 'desc' }, 'status']
table.renderGroup = ({ value, summary }) => `${value} · ${summary.amount} €`

A group is named by its path, region=EMEA/status=Paid. Every group is open until expanded-groups lists the open ones (;-separated in the attribute) or groups-collapsed starts them closed; the first click writes the whole list into expandedGroups, so it can be stored and handed back. group-toggle reports a click, expandGroup(key), collapseGroup(key), expandAll() and collapseAll() do it from script, and getGroups() lists every group with its rows and aggregates. A group’s checkbox selects the rows under it (the selection still holds row keys only), and ←/→ on a group’s first cell close, open and climb the tree.

The groups of the rows at the top of the view stay under the header while their rows scroll. Pages count display lines, so a closed group takes one line, and a page that starts inside a group repeats that group’s headers above its first line. Grouping is done on the client: with a dataSource the table only holds the rows it fetched, so it ignores group-by and says so in the console. Style a group with --c2-table__group-row--*, --c2-table__group-band--background, --c2-table__group--indent, --c2-table__group-toggle--* and --c2-table__group-count--*, or with the group-row, group-cell, group-label and group-count parts.

Rendering a cell

renderCell is a property on the column, so it is set from script. It receives the cell’s value, the whole row and the row index, and returns anything Lit can render.

import { html } from 'lit'
import '@c2n/components/table'
import '@c2n/components/badge'

const table = document.querySelector('c2-table')!
table.rows = await fetchPeople()

const status = table.querySelector<HTMLElement & { renderCell?: unknown }>('c2-table-column[field="status"]')!
status.renderCell = ({ value }) => html`<c2-badge tone=${value === 'active' ? 'success' : 'warning'}>${value}</c2-badge>`

What renderCell returns lives in the table’s shadow root, where a page stylesheet does not reach. Give it a part and the table exposes it as is, so c2-table::part(<name>) styles it. ::part() takes no attribute or class selector, so put the variant in the part name:

status.renderCell = ({ value }) => html`<span part="status status-${value}">${value}</span>`
c2-table::part(status) {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 8px;
}
c2-table::part(status-failed) {
  color: #b91c1c;
}

Wrapping long text

Cells clip to one line by default, which is what a windowed grid of uniform rows needs. Add wrap and body cells grow instead: text wraps, cells are top-aligned with --c2-table__cell__wrap--padding, and each row takes the height of its tallest cell (at least --c2-table__row--height). Rows of different heights cannot be windowed, so wrap turns virtualization off whatever virtual says — every row is rendered. Keep it for a few hundred rows, or page them with page-size.

<c2-table row-key="id" wrap>
  <c2-table-column field="title" header="Title" width="200px"></c2-table-column>
  <c2-table-column field="notes" header="Notes" width="2fr"></c2-table-column>
</c2-table>

Rendering cells with a framework, while virtualizing

A column marked cell-slot takes each cell’s body from a light-DOM child named cell:{line}:{field}, so React, Vue, Svelte or Angular can render it with their own templates. line is the cell’s display line, counted across the whole dataset after sort, filter and grouping with the page offset included: the first row shown is line 0 on the first page. Only the rendered window has those slots: range-change reports one { line, key, row } entry per rendered data row in detail.rows (and renderedRange holds the last window), so render children for those lines only. A child whose line is outside the window is left unassigned, and a line that scrolls in before its child exists shows the column’s formatted value until it arrives. After a sort, filter or page change the same line holds a different row, and range-change fires again with the new rows: re-render the children from it.

The package ships that subscription as useRenderedRows, for React in @c2n/components/react and for Vue 3 in @c2n/components/vue, the same entries that carry the JSX and template types (both frameworks are optional peer dependencies: @c2n/components/table itself never imports them). Each one is seeded from renderedRange, follows the element when the table remounts, returns [] on the server and before the element upgrades, and unsubscribes on unmount.

import { useRenderedRows } from '@c2n/components/react'

const tableRef = useRef<Table>(null)
const rendered = useRenderedRows(tableRef) // TableRenderedRow[]
// {rendered.map(({ line, key, row }) => <button key={key} slot={`cell:${line}:action`}>Open {row.name}</button>)}
import { useTemplateRef } from 'vue'
import { useRenderedRows } from '@c2n/components/vue'

const rendered = useRenderedRows(useTemplateRef<Table>('table')) // Ref<TableRenderedRow[]>
// <button v-for="{ line, key, row } in rendered" :key="key" :slot="`cell:${line}:action`">Open {{ row.name }}</button>

Any other framework wraps subscribeRenderedRows(table, (rows) => …) from @c2n/components/table, the dependency-free core of both: it reports the rows already rendered, then every range-change, and returns the function that unsubscribes.

Enter and Space on a control inside a cell — a slotted button, a renderCell input — belong to that control; the grid only handles them when the cell itself has the focus.

Animating realtime row updates

Add animate-updates when rows represents successive snapshots from a realtime feed. The table matches rows using row-key and smoothly interpolates every changed finite number, including numbers nested in arrays and objects. A custom renderCell receives the same intermediate row, which keeps prices, derived percentages, heat colors and embedded sparklines synchronized. With a stable row-key, additions expand into place and deletions remain briefly to collapse out instead of making the surrounding rows jump.

<c2-table row-key="symbol" animate-updates update-duration="600" highlight-updates update-highlight-field="price">
  <c2-table-column field="symbol" header="Instrument"></c2-table-column>
  <c2-table-column field="price" header="Last" format="currency" currency="USD"></c2-table-column>
</c2-table>

<script type="module">
  const table = document.querySelector('c2-table')
  table.rows = quotes

  feed.addEventListener('snapshot', (event) => {
    // Rows may be added, removed or modified. Assign once; the table owns the transitions.
    table.rows = event.detail.rows
  })
</script>

Animation remains proportional to the rendered window rather than the whole dataset, and automatically becomes an immediate update when the user prefers reduced motion. Set animateUpdates = false or update-duration="0" when an individual feed should jump directly to its latest state.

For a background that represents durable data state instead of a temporary update pulse, set the property-only rowStyle callback. It receives intermediate rows during animation, so a threshold transition is smooth too:

table.rowStyle = ({ row }) => {
  const position = (row.price - row.low) / (row.high - row.low)
  return {
    background: position <= 0.3 ? '#fef2f2' : position >= 0.7 ? '#f0fdf4' : 'transparent',
    transition: 'background 240ms ease-out',
  }
}

Use highlight-updates for a short acknowledgement pulse; use rowStyle when color encodes a state that should remain until the underlying data crosses another threshold.

To style rows by state from a stylesheet instead, set rowPart: the part names it returns are added to the row beside row, since ::part(row) cannot be filtered by the row’s data.

table.rowPart = ({ row }) => (row.status === 'failed' ? 'row-failed' : undefined)
c2-table::part(row-failed) {
  background: #fef2f2;
}

Loading rows lazily

Set dataSource instead of rows and the table asks for one block at a time as rows scroll into view, using the total to size the scrollbar. Sorting is delegated to the source: it arrives as request.sort, and the cache is dropped whenever the sort changes.

table.dataSource = {
  async getRows({ start, count, sort }) {
    const params = new URLSearchParams({ offset: String(start), limit: String(count) })
    if (sort[0]) params.set('sort', `${sort[0].field}:${sort[0].direction}`)
    const response = await fetch(`/api/people?${params}`)
    const { items, total } = await response.json()
    return { rows: items, total }
  },
}

Paging with c2-pagination

Slot a c2-pagination into the footer and the table pages its rows, driving the pager’s page, page-size and total-items — so the pager needs no configuration of its own, and there is nothing to wire up.

<c2-table row-key="id" sortable style="height: 300px">
  <c2-pagination slot="footer" variant="compact" page-size="10"></c2-pagination>
  <c2-table-column field="name" header="Name" width="2fr" sortable></c2-table-column>
  <c2-table-column field="score" header="Score" width="120px" align="end" format="number" sortable></c2-table-column>
</c2-table>

The Paged rows card above is exactly that markup, live.

page-size is what turns paging on, and the table adopts the pager’s own when it has none — which is why the markup above needs nothing else. With rows the page is sliced in place. With a dataSource the same markup pages server-side, one request per page:

const table = document.querySelector('c2-table')
table.pageSize = 25

table.dataSource = {
  async getRows({ start, count, sort }) {
    const params = new URLSearchParams({ offset: String(start), limit: String(count) })
    if (sort[0]) params.set('sort', `${sort[0].field}:${sort[0].direction}`)
    const response = await fetch(`/api/people?${params}`)
    const { items, total } = await response.json()
    return { rows: items, total }
  },
}

table.addEventListener('page-change', (event) => {
  console.log(event.detail.page, event.detail.start, event.detail.count)
})

One page is one request, so block-size does not apply while paging, and revisiting a page you have already seen is served from the block cache. total in the getRows result is what sizes the pager, so a paged source should always return it.

The table owns the numbers, so do not set page, total-items or total-pages on a pager in a footer — everything else about it (variant, the labels, page-size-options, the styling) is still yours.

page is 1-based and reflected, so table.page = 3 moves both the table and the pager, and goToPage() does the same. The table emits one page-change: the pager’s own event does not leave the table. Sorting starts again at page one, since the server order has changed, and a request that fails shows the error until the next page is asked for.

@c2n/components/table deliberately does not import @c2n/components/pagination — import it yourself.

AccordionConnected, animated panels with shared borders and single or multiple expansion.LayoutAction BarA floating bar for the current selection: the count, the bulk actions and a button that clears it.LayoutApp ShellThe frame of an application: header, navigation, main, an optional details panel, banner and footer, laid out from its own width.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 displayBannerA persistent, full-width message in the page flow for system notices, outages and account status.FeedbackBar chartBars over categories or time buckets, with several series drawn side by side within each band.ChartBar ListA ranked list whose rows carry their own bar: top pages, referrers, countries, or the changes between two periods.Data displayBorder BeamA decorative beam that travels around the border of any positioned container.LayoutBottom NavThe mobile tab bar: three to five destinations along the bottom of the screen, each an icon over a short label with a count or dot badge.NavigationBreadcrumbNavigation trail of link buttons with separators, a current page and optional collapsing.NavigationBubble chartAn ECharts scatter plot with a third measure encoded as bubble area, for comparing how two measures relate while showing how much each point weighs.ChartButterfly chartTwo series back to back on a shared category axis, the categories named between them. The population pyramid is the classic case.ChartButtonThemeable 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.LayoutCard InputCard number, expiry date and security code in one field, formatted as the brand prints them and checked as they are typed.InputsCarouselA swipeable slideshow with previous/next controls, indicators, looping and optional autoplay.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.ChatChat Message ListScrolling conversation log that follows new messages, counts unread ones and loads older history.ChatCheckboxNative checkbox behaviour in a quiet, themeable box with an opt-in hover layer.InputsCheckbox groupCheckboxes grouped into one form control with a value array, a group label and an at-least-one rule.InputsChipA compact pill for a filter, a choice or an entered value: selectable as a toggle, removable with a button or the keyboard.InputsChip GroupA single row of chips or badges that collapses whatever does not fit into a +N indicator, recomputed as the row or its items change size.Data displayChoice MatrixRows × columns of checkboxes or radio buttons in one form control: permissions, notification settings, agreement scales.InputsChord chartFlows between groups around a circle, where one row is one flow from a source to a target.ChartCitationA numbered inline marker that names its source, with a hover preview of the page it cites.ChatCode EditorEditable, syntax-highlighted source field on CodeMirror 6, themed entirely through CSS variables.Editors & viewersCode ViewerSyntax-highlighted code with line numbers, copy button and dark mode, powered by shiki.Editors & viewersColor 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.InputsCommandA searchable list of commands: type to filter, arrows to highlight, Enter to run. The core of a ⌘K palette.NavigationComparison BarSegmented ratio bar comparing two or three quantities, such as the bid/ask balance of an order book.Data displayConfirm DialogAsks the user to confirm an action: await show() or confirm() for a true/false answer, with a destructive variant and an async confirm action.FeedbackContext MenuA menu opened by right-clicking or long-pressing an area, built from a slotted c2-menu or a render function per clicked spot.NavigationCopy ButtonButton that copies text to the clipboard — the element it sits in, another element by id, or a literal string.ButtonsCountdownTime left until a date, or through a timer, drawn as segments, a clock or a phrase, and kept current to the second.Data displayDashboardGrid 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.InputsDate StripA row of days to pick one from, a week at a time, with dots on the days that have something on them.InputsDate Time PickerForm-associated date-and-time field with a calendar and time popup, min/max/step constraints and an IANA time zone.InputsDepth chartCumulative bid and ask size around the mid price of an order book, as trading screens show market depth.ChartDescription ListRead-only label and value pairs for a detail page, in columns that wrap with the available width.Data displayDetailsCollapsible disclosure built on native details and summary.LayoutDiff ViewerRead-only line diff of two texts, unified or side by side, with folded unchanged lines and word highlights.Editors & viewersDistribution BarOne 100% stacked bar of a breakdown, with a legend of shares and the hovered part brought forward.Data displayEmoji PickerA searchable grid of emoji in categories, with skin tones and the emoji used last.InputsFacet ListOne facet of a filter sidebar: an attribute’s values with counts, to include or exclude from a search.InputsFieldsetGroups related controls under a legend, with a description, a group-level error and a disabled state that reaches every control inside.InputsFilter BuilderA filter bar of sentence chips (Status is any of Active), an add-filter picker and an editor for each part; it reports a plain JSON filter tree.InputsFloat ButtonA floating action button for the main action of a screen, which can expand into a speed dial of related actions.ButtonsFlowA pipeline, dependency graph or database schema on a pannable canvas: steps with a status, smooth edges, rows joined row to row, auto layout, draggable nodes saved to localStorage, a hover card and a context menu.Editors & viewersFormForm container with validation timing, an error summary, server errors, dirty tracking and async submit.InputsForm FieldLabel, hint, error, warning and character counter around any form control, wired for assistive technology.InputsFormat DateA date and time formatted for the reader's language and, optionally, a fixed time zone.Data displayFormat NumberA number formatted for its locale: currency, percent, units, compact counts and byte sizes, from Intl.NumberFormat.Data displayGanttA read-only project timeline: tasks, groups, milestones and dependencies on a day, week or month scale.PlanningGauge chartA focused radial KPI gauge drawn by ECharts, with a configurable scale, progress arc and pointer.ChartGoogle MapGoogle Maps with markers, a road route from A to B, and Street View, loaded once per page from a browser key.Data displayHeaderArranges brand, navigation, actions and a mobile trigger in a reusable site shell.LayoutHeatmap chartRows binned into cells by two keys, aggregated, and coloured by a sequential, diverging or stepped scale: a currency matrix, pair × tenor, hour × weekday, or a calendar of days. Drawn by ECharts, with a colour key that counts, marks and filters.ChartHighlightMarks the parts of a text that match a search query.Data displayHover CardInteractive preview card shown when a link or mention is hovered or focused, rendered in the top layer.FeedbackIcon ButtonRound, hoverable button wrapping a slotted SVG icon.ButtonsImageImage with lazy loading, a loading placeholder, an error fallback, click-to-load for untrusted URLs and a full-screen preview.Data displayImage CropperChoose the part of an image to keep by moving and resizing a selection, then read it back as a canvas or a blob.Editors & viewersIndicatorSolid dot or count pinned to an edge or corner of any element, with an accessible name for the count.Data displayInline EditText that turns into a field on click: Enter (Ctrl/⌘+Enter when multiline) commits, Escape cancels, and any control with a value that fires change can be the editor.InputsJSON FormA form generated from a JSON Schema, laid out by the schema, a UI schema or your own markup.InputsJSON ViewerBrowse a JSON value as a collapsible tree, search it, and copy any path or value.Editors & viewersKanbanBoard layout and card movement by pointer or keyboard, with cards drawn by your own renderItem.PlanningKbdKeyboard key label for shortcuts and command hints, with the semantics of the native kbd element.Data displayKey Value EditorEditable KEY=value rows for environment variables and headers: paste a .env file to split it into rows, mask secret values, and flag duplicate or malformed keys.InputsLabelCaption 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 displayLoading OverlayCovers a region while it loads: the content stays in place, dimmed and blocked, with a spinner and an announced label.FeedbackLog ViewerExplore large logs with variable-height virtual scrolling and sticky tabular attributes.Editors & viewersMap chartA choropleth and point map on vector outlines, drawn by ECharts: regions shaded by a value, with layers of sized points and flow lines, on the bundled world and US maps or your own GeoJSON, TopoJSON or SVG.ChartMarkdownSafe markdown renderer that streams: chat answers and READMEs, with code, math and diagrams.ChatMarkerAn inline marker that highlights, underlines, strikes through, boxes or circles a run of text.Data displayMask InputA text input that fits what is typed to a pattern, for postcodes, IBANs, tax IDs, expiry dates and other fixed formats.InputsMasonryAutomatically pack differently sized dashboard tiles, then move or resize them in edit mode.LayoutMaster DetailA list beside the record it opens, one pane at a time with a Back step when the element is narrow.LayoutMathTeX formulas rendered as native MathML: no font CSS, readable by screen readers, safe for untrusted input.Data displayMenuCommands, links, checkboxes and submenus in a popover anchored to a trigger.NavigationMenubarDesktop-style File, Edit and View menus in one bar, with the arrow-key and hover movement of an application menu bar.NavigationMermaidMermaid text diagrams drawn in your theme colours, loaded on demand and safe for untrusted sources.Data displayMeterA measurement inside a known range — storage, quota, strength — with native meter thresholds and an optional segmented breakdown.Data displayModalDialog built on the native dialog element: focus trap, backdrop, Escape, title, body and footer.FeedbackMoney InputCurrency amount field that groups digits as you type, follows the locale and stores an integer count of minor units.InputsMonth PickerPick a month, or a year: billing periods, reports and card expiry.InputsMonth PlannerMonth calendar that draws events and trips as bars across the days they cover.PlanningNavigation MenuSite navigation bar whose triggers open panels of links below the header.NavigationNotepadA rich-text notepad that looks like paper: handwriting on ruled lines, a formatting toolbar over the selection, checklists and tear-off pages.PlanningNotification CenterAn inbox panel of notifications grouped by day, with read and unread states and mark all as read.FeedbackNumber InputForm-associated numeric input with native validation, step controls, adornments and helper states.InputsOrg ChartA hierarchy drawn as connected cards that collapse and expand: an organization chart, a reporting line or a team structure.Data displayOTP InputForm-associated one-time-code field with one cell per character, paste and SMS autofill, grouping and masking.InputsOverflow ListOne row of actions or links that shows what fits and folds the rest into a "More" menu, refitting as its width changes.LayoutOverlap chartA Venn diagram of two or three sets, where each circle is a set and each shared area counts the members of exactly that combination.ChartOverlayAnchored popup built on the browser Popover API, positioned with floating-ui.FeedbackPage EditorA Notion-style editor for long text: Markdown shortcuts while you type, a / menu for blocks, a toolbar over selected text, code blocks with syntax colours and eight named colours.Editors & viewersPage HeaderThe top of a page: breadcrumb or parent link, your heading with status badges, description, metadata, page actions that fold into a menu, tabs and a toolbar.LayoutPaginationPage navigation in three layouts: numbered pages, a simple page status, or a table-footer row with rows-per-page.NavigationPassword FieldA password input with a show/hide toggle, a strength meter, a requirements checklist and a Caps Lock warning.InputsPhone InputA phone number field with a searchable country picker, as-you-type grouping and an E.164 value.InputsPie chartA pie or donut chart drawn by ECharts, where one row is one slice and label-field names it.ChartPopconfirmA small "Are you sure?" popup anchored to the button that asked for it.FeedbackProgressProgress bar or ring, indeterminate or filling to a value, with an optional label and count.FeedbackPyramid chartRanked levels of a whole, stacked from a narrow apex to a wide base, where one row is one level.ChartQR CodeGenerate accessible, themeable QR codes locally as crisp SVG graphics.Data displayQuery InputA key:value query field whose filters are chips you can switch off or remove, with syntax highlighting and field and value suggestions, as in Datadog, GitHub and Sentry.InputsQuestionnaireA 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.InputsReaction BarEmoji reactions with counts under a message or comment, toggled by the current user, with a picker to add more.ChatRelative TimeTime relative to now, such as "3 minutes ago" or "in 2 days", that keeps itself current and shows the full date on hover.Data displayReorder ListReorder a vertical queue with pointer or keyboard input while the application owns persistence.Data displayRich Text EditorA compact formatted-text field for comments, replies and email bodies: bold, links, lists, quotes and code, a one-tab-stop toolbar, and a Markdown value.InputsSankey chartQuantities moving through stages, where one row is one flow and each band is as wide as what it carries.ChartSave BarA floating bar that appears while a form has unsaved changes, with Discard and Save.LayoutScatter chartAn ECharts scatter plot for finding relationships, clusters and outliers across two numeric measures.ChartSearch FieldA search box with a debounced search event, a clear button, a keyboard shortcut hint and recent searches.InputsSecret FieldShows an API key or other secret masked, with buttons to reveal it, copy it and ask for a new one.InputsSelectDropdown that pairs a themeable trigger with an anchored list of c2-list-item options.InputsSeparatorHorizontal 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.FeedbackShortcutKeyboard shortcuts for a whole application from one element: each binding fires an action event, runs a handler or activates a target.InputsSide 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.FeedbackSkip LinkA "Skip to main content" link that appears when a keyboard user tabs onto it and moves focus into the main content.NavigationSliderRange 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.FeedbackSplit ButtonA main action with a caret menu of alternatives, such as "Send ▾", or a remembered choice like a merge method.ButtonsSplit PanelTwo panels separated by a divider the user drags, or moves with the keyboard, to resize them.LayoutSpreadsheetA small editable grid with basic formulas, for budgets, quotes, price lists and score sheets.Editors & viewersStatDisplays a KPI with an optional icon, trend and supporting description.Data displayState TimelineOne band per series, coloured by the discrete state it was in over time: service health, CI runs, host power.ChartStatus LightColoured dot plus a short label for the state of something, such as Live, Building or Failed.Data displayStatus PanelCommunicate empty states, operation outcomes and recoverable errors with clear next steps.FeedbackStepsThe trace of a task as it runs, or a stepper across the top of a view: statuses, durations, stages that open while they work, and steps the reader can select.Data displayStickyPins content to the top or bottom of its scroll container and tells you when it is stuck, optionally hiding it while the reader scrolls down.LayoutStreaming TextPlain text that arrives in bursts, such as an LLM answer, revealed at a steady pace behind a caret.ChatSwipe ActionA list row that slides sideways to reveal actions behind it, as in a mail or task list on a phone.LayoutSwitchOn/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 displayTable Of ContentsAn "On this page" navigation that lists the headings of a document, nests them by level and highlights the section being read.NavigationTabsTab strip that shows one content panel at a time.NavigationTag InputTurns typed or pasted text into removable tags — recipients, keywords, labels — with configurable delimiters, parsing and validation.InputsText 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.InputsTime InputForm-associated time-of-day input with a scroll-wheel picker, step and range constraints, helper text and error states.InputsTime Range PickerDashboard time range control: searchable quick ranges, an absolute range typed or picked on a calendar, time zone, shift and zoom, and auto-refresh.InputsTime Slot PickerPick a free time from someone's calendar: a row of days, then that day's times grouped into morning, afternoon and evening.InputsTimelineA vertical sequence of dated events on a connected rail: order history, activity feeds, changelogs.Data displayToastNotification cards and a manager for stacked, queued notifications with independent lifetimes.FeedbackTodo ListA to-do list with the feel of paper: hand-drawn ticks, notes, highlighters, swipe and drag, and a remembered look.PlanningToggletipA small ⓘ button that opens a help bubble on click or tap; the bubble can hold links and is announced to screen readers.FeedbackTooltipContextual hint shown when its target is hovered or focused, rendered in the top layer.FeedbackTourA guided product tour that spotlights one element at a time and explains it in a panel beside it.FeedbackTrace WaterfallShow the spans of a distributed trace as a tree, each with a duration bar on one shared time axis.Data displayTreeHierarchical tree view with expansion, selection, checkboxes and lazy loading.Data displayTree SelectA dropdown for picking one or several rows from a hierarchy, with checkboxes, search and a form value.InputsTreemap chartA whole split into nested rectangles, each sized by its value: market maps, budgets and disk usage.ChartTruncateClamps text to a number of lines, with an optional Show more button.Data displayUploadDrag-and-drop file selection with validation, upload progress, retry, cancellation, and attachment results.InputsView OptionsThe Display popover of a collection: layout, grouping, ordering on several levels, Show switches and visible properties, reported as one plain value.InputsVirtual ListWindowed list with built-in search, sorting, selection and an async data source.Data displayVisually HiddenText for screen readers only: kept in the accessibility tree, drawn nowhere, optionally shown while it holds focus.LayoutWaterfall chartA running total bridged by the steps that move it, where one row is one step and totals mark where the bridge lands.ChartWeek PlannerWeekly schedule with time blocks: a typical week with optional odd and even weeks, or a dated week the user edits.PlanningWorking IndicatorA live "work in progress" line: animated mark, shimmering label, trailing dots and elapsed time.FeedbackFeather 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.IconsSymbols157 themeable spot illustrations for empty states, status panels, onboarding and error pages.IconsTask icons191 duotone icons for to-do items: work, home, health, sport, learning, food, money, travel and more.IconsThemingTheme every c2n component from a handful of design tokens with @c2n/theme, or reach for any component variable directly.GuideLanguagesComponents show their text in English; add your app’s languages as one JSON object, picked by the nearest lang.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, Google Antigravity or GitHub Copilot the c2n skill, live component APIs, examples and application conventions.GuideNo components match.