Skip to content

Object Field

InputMIT
View in Storybook

Nested object form section with grouped fields and collapsible state.

bun add @otfdashkit/ui

Preview

Object Field
Loading Storybook preview…

Code

import { Field, ObjectField, Input } from '@otfdashkit/ui'

export function Example() {
  return (
    <div className="flex flex-col gap-4 max-w-md">
      <ObjectField title="Billing Address" description="Your invoice will be sent here." collapsible>
        <Field label="Street" required><Input placeholder="123 Main St" /></Field>
        <Field label="City" required><Input placeholder="San Francisco" /></Field>
      </ObjectField>
      <ObjectField title="Shipping Address" collapsible defaultOpen={false}>
        <Field label="Street"><Input placeholder="123 Main St" /></Field>
      </ObjectField>
    </div>
  )
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the ObjectField source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
childrenrequiredReactNode
titlerequiredstring
classNamestring
collapsiblebooleanfalse
defaultOpenbooleantrue
descriptionstring