Skip to content
Charts55Components12Visuals14ASCII45
GitHubGet startedGet started
All chartsHex cityCool
PreviousNext: Voxel waffle

CoolCL-18

Hex city

Every store, team, or product as a hexagonal tower, so the biggest stands tall in the middle.

Part
CL-18
Component
HexCityCard
From
@lilt-ui/charts

Store revenue

€837€837
Taller: more · Largest in the middle
Store revenue
ObservationValue
Soho€98
Marais€88
Mitte€83
Shoreditch€76
Kreuzberg€69
Jordaan€64
Camden€61
Pigalle€57
De Pijp€52
Bastille€49
Brixton€44
Neukölln€38
Belleville€31
Noord€27
Default01 / 01

Installation

One package, one sheet.

Add the package, then import the component and the stylesheet once. See Getting started for theming.

$npm install @lilt-ui/charts
import { HexCityCard } from '@lilt-ui/charts';
import '@lilt-ui/charts/styles.css';

Usage

The default card.

The default card above, as you would write it.

<HexCityCard title="Store revenue" data={storeRevenue} label="store" value="revenue" group="region" />

Omit title to leave out the visible title. Set header={false} to remove the whole header, and use aria-label to name a chart inside your own card. legend={false} removes the legend independently. surface="ghost" controls only the visual frame. See Card composition.

Data

The shape it reads.

One row per hexagon with a unique label. By default the largest value stands in the middle and the rest spiral outward by size; arrange="order" keeps your row order instead. group colors the towers and adds a legend with the total for each group. Null stays a low slab.

const storeRevenue = [
  { store: 'Soho', region: 'London', revenue: 98 },
  { store: 'Mitte', region: 'Berlin', revenue: 83 },
  // …one row per store
];

Props38

Every prop.

Every prop HexCityCard accepts, in the order you are likely to reach for them.

PropTypeDescription
titlestringOptional visible title. Omit to render no title. Also supplies the accessible name unless aria-label is set.
headerbooleanDefaults to true. False removes the whole header: title, headline, delta and period controls, with no reserved space. Pass data directly when your app owns period selection.
aria-labelstringAccessible chart name, independent of the visible title. Falls back to title, then a generic chart name.
dataRow[]One row per observation. Omit when using ranges.
heightnumberMinimum plot height, default 260. Dense lanes expand to keep every mark visible.
depthbooleanLit tiles, solid bars, or spheres. Data positions remain exact; loading keeps the same depth treatment.
colorstringOverride the palette with one CSS color.
aggregate'sum' | 'mean' | 'max'Resting headline summary; Strip defaults to mean, the others to sum.
headlinenumberOverride the resting headline.
deltanumberFractional change shown alongside the headline.
deltaTone'default' | 'inverse' | 'neutral'Use inverse when a decrease is good.
rangestringStatic period label.
ranges{ id, label, data, headline?, delta? }[]Period choices with their own data.
defaultRangestringInitial period id.
localestringLocale for numbers and dates; defaults to en-US.
formatValue(value: number) => stringCustom value formatter.
badgeReactNodeContent for the glass tab above the card.
classNamestringClass on the card frame.
styleCSSProperties | ChartStyleInline styles and scoped chart variables.
onSelectionChange(selection | null) => voidReports id, original row (or null for an absent day), value, and pinned state.
renderReadout(selection | null) => ReactNodeConsumer-owned readout, including when the header is hidden.
valueFormatIntl.NumberFormatOptionsFormats the headline, tiles, and axis, e.g. currency.
surface'elevated' | 'outline' | 'ghost'Card treatment. Ghost removes the visual frame only; header and legend are independent controls.
palette'spectrum' | 'iris' | 'cobalt' | 'emerald'Series colors. Spectrum by default; explicit series colors still win.
numberStyle'count' | 'pop' | 'slide' | 'roll' | 'flow' | 'scramble'How the headline animates when its value changes. Count (default) counts to the new value.
loadingbooleanShows a neutral loading skeleton, not data.
loadingStyle'shimmer' | 'draw' | 'breathe'Shimmer sweeps a highlight over still shapes; draw reveals them in order; breathe lets them settle. Follows the selected look, including depth, and respects reduced motion.
empty'dots' | 'shape' | ReactElement | nullWhat the card shows when the period has no data. Dots (default) gathers a quiet dot field around the message; shape lays the chart’s own outline behind it. Pass `<ChartEmpty>` with your own words, any element of your own, or null for nothing. Both looks stay still, so empty never reads as loading, and the headline reads a dash, never zero.
motion'auto' | 'none'None turns off decorative motion; reduced motion does this automatically.
labeltext key of RowUnique name for each hexagon.
valuenumeric key of RowTower height and headline.
grouptext key of RowColors towers by category and adds the legend.
arrange'rank' | 'order'Largest in the middle (default) or your row order.
risenumberHow many hexagon widths the largest value rises, default 2.
gapnumberSpace between hexagons as a share of their size, default 0.12.
legendfalse | 'tiles' | 'inline' | 'list' | 'pills' | 'bars'Group legend layout when group is set. Defaults to tiles.
domain[number, number]Fixed value domain that must contain every value. Defaults to zero through the largest.
onKeyDownKeyboardEventHandler<HTMLElement>Keyboard handler on the card frame. Chart inspection also has its own keyboard handling.
Previous chartTerrainNext chartVoxel waffle

Ready when your data is. Start with one install.

Install a package, import the stylesheet once, and drop in a card or a scene.

Read the guideRead the guideView on GitHubView on GitHub
ChartsAll chartsAll chartsFinanceFinanceCustomizeCustomizeFeaturesFeatures
ComponentsAll componentsAll componentsAIAIStatusStatusActionsActionsDataData
VisualsAll visualsAll visualsAIAIDataDataSecuritySecurityProductProduct
ASCIIAll scenesAll scenesTextTextInterfaceInterfaceBackgroundsBackgroundsMediaMediaDataData
DocsGetting startedGetting startedAPI referenceAPI referenceMotion & accessibilityMotion & accessibilityllms.txtllms.txt
React components with a little lilt.GitHubGitHubnpmnpm