ColorPalette
Stacked colour palette in the style of the Dropbox brand site: a row of
overlapping, bottom-anchored square cards cropped to 16:9. Hovering
or focusing a card smoothly raises it and reveals a search action that
deep-links into the colours search page.
The component renders only the swatch row - no card, heading, or CTA
chrome. Compose those around it (a <section>, a title, a sample button
wired to onSelectedIdsChange) when a surface calls for them.
Cards can be flat colours, gradients, or images (see ColorPaletteItem).
Image cards need a searchHex to be clickable.
With selectable, clicking anywhere on a card toggles it in and out of
the selection instead of linking out; selected cards keep a check
visible at rest, and the selection surfaces through onSelectedIdsChange.
Usage
Best practices
Describe cards as
items(kind: "color" | "gradient" | "image"), not hand-built markup - the component owns the overlap, hover-raise, and deep-link-to-search behaviour.Give every
imagecard asearchHex, otherwise it can't be searched or selected - flat colours and gradients derive theirs automatically.Pass
renderLink(e.g. wrappingnext/link) for client-side nav - the built-in links are plain<a>; the callback must return a single anchor element.
Props
Also exports
- const
buildSampleHref - const
buildSearchHref - type
ColorPaletteItem - interface
ColorPaletteLinkProps - interface
ColorPaletteProps - const
getPaletteItemId - const
getSampleHex - type
PaletteDirection - type
PaletteSort - const
sortPaletteItems