Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Field

Combine labels, controls, and help text to compose accessible form fields and grouped inputs.

Payment Method

All transactions are secure and encrypted

Enter your 16-digit number.

Billing Address

The billing address associated with your payment method

Installation

pnpm add @heyramzi/ui

Usage

import * as Field from "@heyramzi/ui/shadcn/field";
<Field.Set>
  <Field.Legend>Payment method</Field.Legend>
  <Field.Description>All transactions are secure and encrypted.</Field.Description>
  <Field.Group>
    <Field.Field>
      <Field.Label for="card-number">Card number</Field.Label>
      <input id="card-number" placeholder="1234 5678 9012 3456" />
      <Field.Description>Enter your 16-digit number.</Field.Description>
    </Field.Field>
  </Field.Group>
</Field.Set>

Keyboard and accessibility

  • Field is a group. A FieldSet with a FieldLegend names a whole set of controls.
  • FieldError has role="alert", so it's read out when it appears.
  • Field doesn't link the description or error to the control. Set aria-describedby yourself, or use SimpleField, which does.

API reference

Field

orientation "vertical" | "horizontal" | "responsive"
Default "vertical"
ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
orientation "vertical" | "horizontal" | "responsive" "vertical"
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Set

ref bindable HTMLFieldsetElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLFieldsetAttributes from svelte/elements
Prop Type Default
ref bindable HTMLFieldsetElement | null null
class string
children Snippet
...rest Every prop of HTMLFieldsetAttributes from svelte/elements

Legend

variant "legend" | "label"
Default "legend"
ref bindable HTMLLegendElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLLegendElement> from svelte/elements
Prop Type Default
variant "legend" | "label" "legend"
ref bindable HTMLLegendElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLLegendElement> from svelte/elements

Group

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Content

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Label

ref bindable Label
Default null
class string
children Snippet
...rest
Every prop of Label
Prop Type Default
ref bindable Label null
class string
children Snippet
...rest Every prop of Label

Title

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Description

ref bindable HTMLParagraphElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLParagraphElement> from svelte/elements
Prop Type Default
ref bindable HTMLParagraphElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLParagraphElement> from svelte/elements

Separator

children Snippet
ref bindable HTMLDivElement | null
Default null
class string
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
children Snippet
ref bindable HTMLDivElement | null null
class string
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Error

children Snippet
errors { message?: string }[]
ref bindable HTMLDivElement | null
Default null
class string
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
children Snippet
errors { message?: string }[]
ref bindable HTMLDivElement | null null
class string
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Simple

label string
description string
error string
for string
Id of the control the label binds to. Also picks the control that gets the message link.
labelVariant "default" | "muted"
Default "default"
"default" is text-sm foreground; "muted" is a text-xs micro-label.
class string
children required Snippet
Prop Type Default
label string
description string
error string
for

Id of the control the label binds to. Also picks the control that gets the message link.

string
labelVariant

"default" is text-sm foreground; "muted" is a text-xs micro-label.

"default" | "muted" "default"
class string
children required Snippet