コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
Developer resources
概要
バージョン管理
変更ログ
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
パートナー認定
ホームDeveloper resourcesStripe AppsComponents

注

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

Stripe Apps の Switch コンポーネント

Checkbox と同様に、Switch を使用して boolean 値の指定または制御を行うことができます。

ページをコピー

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

import {Switch} from '@stripe/ui-extension-sdk/ui';

Switch (スイッチ) は一般に、すぐに保存する設定に使用されます。そのため、Switch が、別々に送信する必要がある大規模なフォームの構成部分になることは稀です。

Switch の単純な例を次に示します。

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

Switch props

プロパティータイプ

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

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

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.

ステータス管理

Use the Switch component as an uncontrolled input:

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

無効化

Switch コンポーネントは無効化でき、これにより変更できなくなります。

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

参照情報

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