Button

ボタンコンポーネントです。ユーザーのアクションを受け付けるために使用します。

基本

<CheButton>ボタン</CheButton>

バリアント

variant でボタンのスタイルを指定できます。デフォルトは "primary" です。

<CheButton variant="primary">ボタン</CheButton>
<CheButton variant="secondary">ボタン</CheButton>
<CheButton variant="tertiary">ボタン</CheButton>

サイズ

heightwidth でボタンのサイズを指定できます。デフォルトは height="44" width="120" です。

<CheButton height="44" width="295">ボタン</CheButton>
<CheButton height="44" width="120">ボタン</CheButton>
<CheButton height="36" width="110">ボタン</CheButton>

無効状態

disabled でボタンを無効化できます。

<CheButton variant="primary" disabled>ボタン</CheButton>
<CheButton variant="secondary" disabled>ボタン</CheButton>
<CheButton variant="tertiary" disabled>ボタン</CheButton>

Prefix / Suffix

iconOptions でボタンテキストの前後にアイコンを配置できます。

Prefix

<CheButton iconOptions={{ position: "prefix", name: "search", size: 4.5 }}>
  検索
</CheButton>

Suffix

<CheButton iconOptions={{ position: "suffix", name: "arrow-right", size: 4.5 }}>
  次へ
</CheButton>

div要素として使用

as="div" を指定すると <div> 要素として描画されます。<a> タグで囲んでナビゲーション用途に使う場合に便利です。

<a href="/path">
  <CheIconButton as="div" iconName="search" aria-label="検索" />
</a>

すべてのバリエーション

すべてのバリエーション一覧は カタログページ を参照してください。

Props

属性詳細デフォルト必須
childrenボタンテキストReactNode-Yes
asレンダリングする要素”button” | “div""button”No
variantボタンスタイル”primary” | “secondary” | “tertiary""primary”No
heightボタンの高さ”44” | “36""44”No
widthボタンの幅”295” | “120” | “110”heightに応じて"120"または"110"No
typeボタンタイプ(as=“button” 時)“button” | “submit” | “reset”-No
classNameカスタムクラスstring-No
disabled無効状態(as=“button” 時)booleanfalseNo
iconOptionsアイコン設定IconOptions-No