コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
バージョン管理
変更ログ
API バージョンのアップグレード
SDK バージョンをアップグレードする
開発者向けのツール
SDK
API
テスト
ワークベンチ
イベントの送信先
ワークフロー
Stripe CLI
Stripe Shell
開発者ダッシュボード
エージェントツールキット
LLM を使用した構築Visual Studio Code をご利用の場合Stripe 健全性アラートファイルのアップロード
セキュリティとプライバシー
セキュリティ
プライバシー
Stripe を拡張する
Stripe Apps
    概要
    始める
    アプリを作成する
    Stripe アプリの仕組み
    サンプルアプリ
    アプリを構築する
    シークレットを保存
    API 認証方法
    認証フロー
    サーバー側のロジック
    イベントのリッスン
    さまざまな環境を処理
    サンドボックスのサポートを有効にする
    アプリの設定ページ
    UI を構築する
    アカウント登録
    アプリを配布する
    配布オプション
    アプリをアップロード
    バージョンとリリース
    アプリをテストする
    アプリを公開する
    自分のアプリを宣伝する
    ディープリンクを追加する
    インストールリンクを作成
    UI 拡張機能で役割を割り当て
    インストール後のアクション
    アプリのアナリティクス
    アプリの埋め込みコンポーネント
    サードパーティーの Stripe アプリを埋め込む
    Stripe Apps に移行
    拡張機能を移行または構築
    Stripe Apps または Stripe Connect にプラグインを移行
    参照情報
    アプリマニフェスト
    CLI
    拡張 SDK
    権限
    ビューポート
    設計パターン
    コンポーネント
      アコーディオン
      バッジ
      バナー
      BarChart
      ボックス
      ボタン
      ButtonGroup
      チェックボックス
      チップ
      ContextView
      DateField
      ディバイダー
      FocusView
      FormFieldGroup
      アイコン
      Img
      インライン
      LineChart
      Link
      リスト
      メニュー
      PropertyList
      ラジオ
      選択してください
      SettingsView
      SignInView
      Sparkline
      スピナー
      切り替える
      テーブル
      タブ
      タスクリスト
      テキスト領域
      テキストフィールド
      トースト
      ツールチップ
Stripe のコネクター
パートナー
Partner Ecosystem
パートナー認定
ホーム開発者向けのツールStripe AppsComponents

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Stripe Apps の Checkbox コンポーネント

チェックボックスを使用して、boolean 値の指定または制御を行います。

ページをコピー

Checkbox コンポーネントをアプリに追加するには、以下のようにします。

import {Checkbox} from '@stripe/ui-extension-sdk/ui';
サンプルを読み込み中...
<Checkbox label="This is a Checkbox." onChange={(e) => { console.log(e.target.checked); }} />

Checkbox は、適切なすべてのネイティブ DOM 属性のほかに、以下のプロパティーを受け入れます。

Checkbox のプロパティ

プロパティータイプ

autoFocus

オプション

boolean | undefined

If true, React will focus the element on mount.

checked

オプション

boolean | undefined

Controls whether the input is selected. When you pass this prop, you must also pass an onChange handler that updates the passed value.

defaultChecked

オプション

boolean | undefined

Specifies the initial value that a user can change.

description

オプション

string | undefined

コントロールのラベルの横にレンダリングされる説明テキスト。

disabled

オプション

boolean | undefined

要素を無効化するかどうかを設定します。選択できなくなります。

error

オプション

string | undefined

コントロールの下に表示されるエラーテキスト。

form

オプション

string | undefined

Specifies the id of the <form> this input belongs to. If omitted, it’s the closest parent form.

hiddenElements

オプション

("label" | "description" | "error")[] | undefined

指定した要素を視覚的に非表示にします。非表示の要素は引き続き存在しており、スクリーンリーダーに表示されます。

indeterminate

オプション

boolean | undefined

Sets whether the Checkbox should be rendered as indeterminate (“partially checked”) or not. Note that this is purely visual, and will not change the actual checked state of the Checkbox. If a Checkbox is both indeterminate and checked, it will display as indeterminate.

invalid

オプション

boolean | undefined

要素が無効な状態であるかどうかを設定します。これは、表示専用のプロパティであり、フォーム送信を妨げるものではありません。

label

オプション

React.ReactNode

コントロールを説明するテキスト。表示され、クリック可能になります。

name

オプション

string | undefined

Specifies the name for this input that’s submitted with the form.

onChange

オプション

((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined

Required for controlled inputs. Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke). Behaves like the browser input event.

readOnly

オプション

boolean | undefined

If true, the input is not editable by the user.

required

オプション

boolean | undefined

If true, the value must be provided for the form to submit.

tabIndex

オプション

number | undefined

Overrides the default tab key behavior. Avoid using values other than -1 and 0.

value

オプション

string | undefined

Controls the input’s text. When you pass this prop, you must also pass an onChange handler that updates the passed value.

Checkbox コンポーネントを別のステータスに設定できます。

  • indeterminate
  • disabled
  • invalid

不確定

Checkbox コンポーネントは、indeterminate 状態にすることができます。これは、checked とそうでないものが含まれる可能性がある他のチェックボックスのセットの集約状態を表す場合に利用できます。このプロパティは純粋に視覚的なものであり、Checkbox の基になる checked 状態に影響を与えないことに注意してください。

サンプルを読み込み中...
const [checked1, setChecked1] = React.useState(false); const [checked2, setChecked2] = React.useState(true); const allChecked = checked1 && checked2; const handleAggregateChange = () => { if (checked1 && checked2) { setChecked1(false); setChecked2(false); } else { setChecked1(true); setChecked2(true); } }; return ( <Box css={{ stack: 'y', }} > <Checkbox label="This Checkbox is aggregating the state of the Checkboxes below it." checked={allChecked} indeterminate={checked1 !== checked2} onChange={handleAggregateChange} /> <Checkbox label="Checkbox 1" checked={checked1} onChange={(e) => { setChecked1(e.target.checked); }} /> <Checkbox label="Checkbox 2" checked={checked2} onChange={(e) => { setChecked2(e.target.checked); }} /> </Box> )

無効化

Checkbox は disabled に設定できます。こうすると、変更できなくなります。

サンプルを読み込み中...
<Checkbox label="This Checkbox is disabled." defaultChecked disabled /> <Checkbox disabled invalid label="This invalid Checkbox is disabled." />

無効

Checkbox コンポーネントに invalid のマークを付けることができます。これはスタイリング専用のプロパティであり、フォームの検証に役立ちます。フォームの送信が妨げられることはありません。

サンプルを読み込み中...
<Checkbox label="This Checkbox is in an invalid state." invalid />

ステータス管理

Use the Checkbox component as an uncontrolled input:

サンプルを読み込み中...
<Checkbox onChange={(e) => { console.log(e.target.checked); }} defaultChecked label="This Checkbox is uncontrolled." />

参照情報

  • 従うべき設計パターン
  • アプリのスタイル設定
  • UI テスト
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc