Skip to content
Klarhimmel UI

Preset tile

npx shadcn add @klarhimmel/theme-parts
DetailsAbout, usage, props and more

One theme preset as a pressable tile: its page, text and accent swatches, its name and a line on its look. Spread an item of listPresets() into it.

Preview

Preset tile
preset-tile.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { PresetTile } from '@/components/klarhimmel/ui/theme-parts';

export default function Example() {
  return (
    <Theme theme="brand">
      <PresetTile name="Harbor" look="Navy ink and a teal accent, tight corners." swatches={{ canvas: '#f7f8fa', ink: '#0f1b2d', accent: '#0f766e' }} pressed onPress={(name) => console.log(name)} />
    </Theme>
  );
}

Import

Import

import { PresetTile } from '@/components/klarhimmel/ui/theme-parts';
Files
theme-parts.tsx, in components/klarhimmel/ui/. With it: input, theme, utils.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
namestringrequiredThe preset and a line on how it looks.
lookstring-The preset and a line on how it looks.
swatches{ canvas: string; ink: string; accent: string }requiredHex colours of its page, text and accent.
pressedbooleanfalseThe chosen preset.
onPress(name: string) => void-Called with the preset's name.
disabledboolean-
classNamestring-Extra classes, merged after the component's own.
modestring-