Palette
The colours of a brand or a design guide, each one as a sample with its name and its code. It only shows them; to choose one, use ColorSwatchPicker.
import { Palette, PaletteSkeleton } from '@sypnia/ui/react'
A design guide
- Oven
#2b1a12 - Crust
#9a5426 - Crumb
#f6ead3 - Butter
#f2b443 - Laurel
#46613a
Code
import { Palette } from '@sypnia/ui/react';
// The palette of a bakery's design guide: each colour with the name the guide gives it and its code.
export default function Guide() {
return (
<Palette label="Palette of La Espiga" colors={[
{ value: '#2b1a12', name: 'Oven' }, { value: '#9a5426', name: 'Crust' }, { value: '#f6ead3', name: 'Crumb' },
{ value: '#f2b443', name: 'Butter' }, { value: '#46613a', name: 'Laurel' },
]} />
);
} Only the codes
Without names, the code under each sample is what is read.
#2b1a12#9a5426#f6ead3#f2b443
Code
import { Palette } from '@sypnia/ui/react';
// Colours without names: the code is written under each sample.
export default function Codes() {
return <Palette label="Colours of the new menu" colors={['#2b1a12', '#9a5426', '#f6ead3', '#f2b443'].map((value) => ({ value }))} />;
} Skeleton
- Oven
#2b1a12 - Crust
#9a5426 - Crumb
#f6ead3
Code
import { Palette, PaletteSkeleton, Stack } from '@sypnia/ui/react';
// While the guide loads: as many samples as will come, with the place of their names and codes.
export default function Skeleton() {
return (
<Stack gap={5}>
<PaletteSkeleton items={3} names />
<Palette label="Palette" colors={[{ value: '#2b1a12', name: 'Oven' }, { value: '#9a5426', name: 'Crust' }, { value: '#f6ead3', name: 'Crumb' }]} />
</Stack>
);
} When to use it
Use it when
- A design guide, a brand page, the theme of a site.
Do not use it when
- Letting the person choose a colour: that is ColorSwatchPicker or ColorPicker.
For everyone
- It is a named list; each colour is read by its name and its code, never by the sample alone.
Props
| Palette | Type | Default |
|---|---|---|
colorsrequired | PaletteColor[] | |
labelrequired | string |
| PaletteSkeleton | Type | Default |
|---|---|---|
items | number | 5 |
names | boolean |