コンポーネント
フィールド
ラベル、説明、エラーと1つのコントロールをまとめます。
使い方
基本
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>無効な状態
フィールドを無効としてマークすると、コントロールの色が変わり、その下にメッセージが表示されます。
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>必須
要件を詳しく記すのはヘルプテキストの役割なので、ラベルは短く保ちます。
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>無効
フィールドとその中のコントロールを無効にすると、行全体がロックされた状態に見えます。
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>選択フィールド
フィールドは単一の入力欄と同じように、グループ化されたコントロールもまとめます。
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>構造
フィールドは以下のブロックで構成されます。それぞれ独立したブロックで、親の内部でのみレンダリングされます。
bsui/fieldbsui/field-descriptionbsui/field-errorbsui/field-label
属性
| 属性 | タイプ | デフォルト |
|---|---|---|
name | text | — |
invalid | toggle | false |
disabled | toggle | false |
bsui/field-description
| 属性 | タイプ | デフォルト |
|---|---|---|
text | richtext | — |
bsui/field-error
| 属性 | タイプ | デフォルト |
|---|---|---|
text | richtext | — |
bsui/field-label
| 属性 | タイプ | デフォルト |
|---|---|---|
text | richtext | — |