Vai al contenuto

Componenti

Campo

Raggruppa un controllo con etichetta, descrizione ed errore.

Utilizzo

Base

We only use this for receipts.
HTML
<bs:bsui-field>
  <bs:bsui-field-label text="Email address" />
  <bs:bsui-input type="email" placeholder="you@example.com" />
  <bs:bsui-field-description text="We only use this for receipts." />
</bs:bsui-field>

Stato non valido

Segnare il campo come non valido cambia il colore del controllo e mostra il messaggio sottostante.

Enter an address with a domain, like ada@example.com.
HTML
<bs:bsui-field invalid="true">
  <bs:bsui-field-label text="Work email" />
  <bs:bsui-input type="email" defaultValue="ada@example" />
  <bs:bsui-field-error text="Enter an address with a domain, like ada@example.com." />
</bs:bsui-field>

Obbligatorio

Il testo di aiuto spiega il requisito, così l’etichetta può restare breve.

Required. This name appears on every invoice.
HTML
<bs:bsui-field>
  <bs:bsui-field-label text="Workspace name" />
  <bs:bsui-input placeholder="Acme Production" required="true" />
  <bs:bsui-field-description text="Required. This name appears on every invoice." />
</bs:bsui-field>

Disabilitato

Disabilitate il campo e il controllo al suo interno, così l’intera riga risulta bloccata.

The URL is fixed once the workspace is created.
HTML
<bs:bsui-field disabled="true">
  <bs:bsui-field-label text="Workspace URL" />
  <bs:bsui-input defaultValue="acme.blockstudio.dev" disabled="true" />
  <bs:bsui-field-description text="The URL is fixed once the workspace is created." />
</bs:bsui-field>

Campo di scelta

Un campo racchiude i controlli raggruppati proprio come fa con un singolo input.

Pick a target before deploying.
HTML
<bs:bsui-field invalid="true">
  <bs:bsui-field-label text="Deploy target" />
  <bs:bsui-radio-group orientation="horizontal">
    <bs:bsui-radio value="staging" label="Staging" />
    <bs:bsui-radio value="production" label="Production" />
  </bs:bsui-radio-group>
  <bs:bsui-field-error text="Pick a target before deploying." />
</bs:bsui-field>

Struttura

Campo è composto dai blocchi seguenti. Ognuno è un blocco separato che viene visualizzato solo all'interno del proprio genitore.

  • bsui/field
  • bsui/field-description
  • bsui/field-error
  • bsui/field-label

Attributi

AttributoTipoPredefinito
name text —
invalid toggle false
disabled toggle false

bsui/field-description

AttributoTipoPredefinito
text richtext —

bsui/field-error

AttributoTipoPredefinito
text richtext —

bsui/field-label

AttributoTipoPredefinito
text richtext —