インポート
import { Callout } from '@k8ordo/ui';使い方
Note
Values stay in the DOM, so typing never re-renders.
<Callout label="Note" tone="info">
<p>Values stay in the DOM, so typing never re-renders.</p>
</Callout>トーン
Supported
Works in every core browser.
Note
The browser checks the input before it is sent.
Pitfall
A controlled field is not restored by a form reset.
Deprecated
This option goes away in the next major.
<Callout label="Supported" tone="success">…</Callout>
<Callout label="Note" tone="info">…</Callout>
<Callout label="Pitfall" tone="warning">…</Callout>
<Callout label="Deprecated" tone="error">…</Callout>本文のコードとリンク
本文はchildrenなので、段落を重ねたりCodeやAnchorを入れたりできます。labelを省くと、アイコンと本文だけになります。
Pitfall
Passing value makes the field controlled, and a form reset no longer restores it.
Pass defaultValue instead. See the input reference.
This article reflects the API as of July 2023.
<Callout label="Pitfall" tone="warning">
<p>
Passing <Code>value</Code> makes the field controlled, and a form
reset no longer restores it.
</p>
<p>
Pass <Code>defaultValue</Code> instead. See{' '}
<Anchor href="https://react.dev/reference/react-dom/components/input">
the input reference
</Anchor>
.
</p>
</Callout>
<Callout tone="info">
<p>This article reflects the API as of July 2023.</p>
</Callout>Alertとの使い分け
Alertは操作の結果やアプリの状態を知らせ、表示されるとスクリーンリーダーが読み上げます。記事やガイドの本文に置く補足にはCalloutを使います。role="note"なので、ページの読み込みやクライアントでの遷移で差し込まれても読み上げられません。
Props
children- Type:
ReactNode - Default: -
tone- Type:
Status - Default: -
label?- Type:
string - Default: -
| Prop | Type | Default |
|---|---|---|
children | ReactNode | - |
tone | Status | - |
label? | string | - |
継承する属性(内部で固定するものを除く): HTMLAttributes<HTMLDivElement>
ラベルやプレースホルダーなど、このコンポーネントが描く文言は、propsで指定しないと文言辞書から読まれます。差し替え方は次を見てください: コンポーネントの文言