Field
A control with label and error.
Anatomy
<script>
import { Field } from '@shardsui/svelte/field'
</script>
<Field.Root>
<Field.Label />
<Field.Control />
<Field.Description />
<Field.Item />
<Field.Error />
<Field.Validity />
</Field.Root>API reference
Root
Groups a control with its label, description and error.
Renders a <div> element.
Label
An accessible label, associated with the field control automatically.
Renders a <label> element.
Control
The form control to label and validate.
Renders an <input> element.
Other standard <input> props (type, required, pattern, placeholder, etc.) pass through, as
do <textarea> props (rows, cols, wrap) when as="textarea".
Description
Additional information about the field, added to the control's accessible description.
Renders a <p> element.
Item
Groups one item of a checkbox or radio group with its own label and description.
Renders a <div> element.
Error
An error message shown when the field fails validation. While visible, it is part of the control's
accessible description.
Renders a <div> element.
Without children, the part renders the current error message, or a <ul> of them when there is
more than one.
Validity
Renders custom content from the field's validity state. Doesn't render its own HTML element.