Skip to content
Klarhimmel UI

Settings edit row

Business name

Lindqvist Bakery

npx shadcn add @klarhimmel/settings
DetailsAbout, usage, props and more

A row that shows its value and edits it in place: Edit turns it into a field with Save and Cancel; Enter saves, Escape cancels.

Preview

Settings edit row
settings-edit-row.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { SettingsEditRow } from '@/components/klarhimmel/ui/settings';

export default function Example() {
  return (
    <Theme theme="brand">
      <SettingsEditRow label="Business name" value="Lindqvist Bakery" onSave={async (v) => v.trim().length > 0} />
    </Theme>
  );
}

Import

Import

import { SettingsEditRow } from '@/components/klarhimmel/ui/settings';
Files
settings.tsx, in components/klarhimmel/ui/. With it: button, card, input, switch, 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
labelReactNoderequiredThe row's words.
descriptionReactNode-The row's words.
valuestringrequiredThe saved value.
placeholderstring-Shown when the value is empty.
onSave(value: string) => boolean | Promise<boolean>requiredSaves; answers whether it did.
editLabelstring'Edit'Button words, for another language.
saveLabelstring'Save'Button words, for another language.
cancelLabelstring'Cancel'Button words, for another language.
classNamestring-Extra classes, merged after the component's own.