Field & Input Group
Campos, rótulos, descrições, erros e grupos de input com complementos — inputs nativos estilizados pelo sistema.
Disponível em
Angular: disponível Vue: disponível React: disponível React Native: disponível
Uso
<form soneFieldGroup style="max-width: 26rem" (submit)="$event.preventDefault()">
<div soneField>
<label soneFieldLabel for="demo-name">Display name</label>
<input id="demo-name" type="text" placeholder="Alex Doe" />
<p soneFieldDescription>Shown to people you share notes with.</p>
</div>
<div soneField invalid>
<label soneFieldLabel for="demo-site">Website</label>
<div soneInputGroup>
<span soneInputGroupAddon><span soneInputGroupText>https://</span></span>
<input soneInputGroupInput id="demo-site" type="text" value="not a host" />
</div>
<p soneFieldError>Enter a host name, such as example.com.</p>
</div>
<div soneField>
<label soneFieldLabel for="demo-quota">Storage limit</label>
<div soneInputGroup>
<input soneInputGroupInput id="demo-quota" type="number" value="20" />
<span soneInputGroupAddon align="inline-end"><span soneInputGroupText>GB</span></span>
<span soneInputGroupAddon align="inline-end">
<button soneBtn variant="ghost" size="xs" type="button">Reset</button>
</span>
</div>
</div>
<fieldset soneFieldSet>
<legend soneFieldLegend variant="label">Notify me about</legend>
<div soneFieldGroup variant="choices">
<div soneField orientation="horizontal">
<input id="demo-mentions" type="checkbox" checked />
<label soneFieldLabel for="demo-mentions">Mentions and replies</label>
</div>
<div soneField orientation="horizontal">
<input id="demo-digest" type="checkbox" />
<label soneFieldLabel for="demo-digest">Weekly digest</label>
</div>
</div>
</fieldset>
<div soneField>
<label soneFieldLabel for="demo-bio">Bio</label>
<textarea id="demo-bio" placeholder="A sentence or two about you."></textarea>
</div>
</form>Importação
import {
SoneFieldContentDirective,
SoneFieldDescriptionDirective,
SoneFieldDirective,
SoneFieldErrorDirective,
SoneFieldGroupDirective,
SoneFieldLabelDirective,
SoneFieldLabelOptionalDirective,
SoneFieldLegendDirective,
SoneFieldSeparatorContentDirective,
SoneFieldSeparatorDirective,
SoneFieldSetDirective,
SoneFieldTitleDirective,
SoneInputGroupAddonDirective,
SoneInputGroupControlDirective,
SoneInputGroupDirective,
SoneInputGroupTextDirective,
SoneLabelDirective,
} from "@surface-one/angular/input";Referência da API
SoneFieldContentDirectiveDiretiva
SoneFieldDescriptionDirectiveDiretiva
SoneFieldDirectiveDiretiva
| Nome | Tipo | Padrão |
|---|---|---|
orientation | FieldOrientation | "vertical" |
invalid | boolean | false |
disabled | boolean | false |
SoneFieldErrorDirectiveDiretiva
SoneFieldGroupDirectiveDiretiva
| Nome | Tipo | Padrão |
|---|---|---|
variant | "default" | "choices" | "default" |
SoneFieldLabelDirectiveDiretiva
SoneFieldLabelOptionalDirectiveDiretiva
`[soneFieldLabelOptional]` — the quiet "Optional" marker inside a field label: `<label soneFieldLabel>Notes <span soneFieldLabelOptional>Optional</span></label>`.
SoneFieldLegendDirectiveDiretiva
| Nome | Tipo | Padrão |
|---|---|---|
variant | "legend" | "label" | "legend" |
SoneFieldSeparatorContentDirectiveDiretiva
SoneFieldSeparatorDirectiveDiretiva
SoneFieldSetDirectiveDiretiva
SoneFieldTitleDirectiveDiretiva
SoneInputGroupAddonDirectiveDiretiva
| Nome | Tipo | Padrão |
|---|---|---|
align | InputGroupAddonAlign | "inline-start" |
SoneInputGroupControlDirectiveDiretiva
SoneInputGroupDirectiveDiretiva
| Nome | Tipo | Padrão |
|---|---|---|
invalid | boolean | false |
disabled | boolean | false |
fillTake the free space of a flex row (`flex: 1`, may shrink) — a search box beside buttons. | boolean | false |
variant`filled`: a grey fill instead of a border (the focus ring stays). A filled field has no 3:1 boundary of its own, so keep it to search boxes that a leading search glyph and a placeholder identify. | InputGroupVariant | "default" |