# Simple field

A label, a hint or an error, and the control, with the message linked to it.

Section: Components / Inputs
Page: https://ui.heyramzi.com/components/simple-field
Import path: `@heyramzi/ui/shadcn/field`

## Import

```ts
import { SimpleField } from "@heyramzi/ui/shadcn/field";
import { Input } from "@heyramzi/ui/shadcn/input";
```

## Usage

```svelte
<SimpleField label="Email" for="email" description="We reply within a day." {error}>
  <input id="email" bind:value={email} />
</SimpleField>
```

## Demo

```svelte
<script lang="ts">
	import { SimpleField } from "@heyramzi/ui/shadcn/field";
	import { Input } from "@heyramzi/ui/shadcn/input";

	let email = $state("team@");
	let error = $derived(
		email.includes("@") && email.split("@")[1] ? undefined : "Enter a full email address",
	);
</script>

<div class="w-72">
	<SimpleField label="Email" for="field-demo-email" description="We reply within a day." {error}>
		<Input id="field-demo-email" bind:value={email} />
	</SimpleField>
</div>
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `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" is text-sm foreground; "muted" is a text-xs micro-label. |
| `class` | `string` |  |  |
| `children` | `Snippet` |  | required |
