テーマ

... 概要 ... カラー ... ダークモード ... タイポグラフィ ... スペーシング ... ブレークポイント ... 角丸 ... シャドウ ... カーソル ...

レイアウト

... Box ... Flex ... Grid ... Container ... Section ...

タイポグラフィ

... Text ... Heading ... Blockquote ... Code ... Em ... Kbd ... Link ... Quote ... Strong ...

コンポーネント

... アラートダイアログ ... アスペクト比 ... アバター ... バッジ ... ボタン ... コールアウト ... カード ... チェックボックス ... チェックボックスグループ ... チェックボックスカード ... コンテキストメニュー ... データリスト ... ダイアログ ... ドロップダウンメニュー ... ホバーカード ... アイコンボタン ... インセット ... ポップオーバー ... プログレス ... ラジオボタン ... ラジオボタングループ ... ラジオボタンカード ... スクロールエリア ... セグメントコントロール ... セレクト ... セパレーター ... スケルトン ... スライダー ... スピナー ... スイッチ ... テーブル ... タブ ... タブナビゲーション ... テキストエリア ... テキストフィールド ... ツールチップ ...

ユーティリティ

... アクセシブルアイコン ... Portal ... Reset ... Slot ... Theme ... 視覚的に隠す ...
コンポーネント

テーマ

Reactツリーの全体または一部をラップして、テーマ設定を提供します。

APIリファレンス

テーマの概要については、概要ページをご覧ください。

プロパティデフォルト値
asChild
boolean(真偽値)
デフォルト値なし
hasBackground
boolean(真偽値)
true(真)
appearance
"inherit" | "light" | "dark"
"inherit"
accentColor
enum(列挙型)
"indigo"
grayColor
enum(列挙型)
"auto"
panelBackground
"solid" | "translucent"
"translucent"
radius
"none" | "small" | "medium" | "large" | "full"
"medium"
scaling
"90%" | "95%" | "100%" | "105%" | "110%"
"100%"

基本設定

Themeコンポーネントでコンポーネントツリーをラップして、すべての子要素の設定を提供または変更します。

フィードバック
<Box maxWidth="400px">
<Card size="2">
<Flex direction="column" gap="3">
<Grid gap="1">
<Text as="div" weight="bold" size="2" mb="1">
Feedback
</Text>
<TextArea placeholder="Write your feedback…" />
</Grid>
<Flex asChild justify="between">
<label>
<Text color="gray" size="2">
Attach screenshot?
</Text>
<Switch size="1" defaultChecked />
</label>
</Flex>
<Grid columns="2" gap="2">
<Button variant="surface">Back</Button>
<Button>Send</Button>
</Grid>
</Flex>
</Card>
</Box>

ネスト

別のテーマをネストして、特定のサブツリーの設定を変更します。設定は親から継承されます。

グローバル
フィードバック
子要素
フィードバック
孫要素
フィードバック
<Card size="2">
<Flex gap="6">
<Flex direction="column" gap="3">
<Heading as="h5" size="2">
Global
</Heading>
<Grid gap="1">
<Text as="div" weight="bold" size="2" mb="1">
Feedback
</Text>
<TextArea placeholder="Write your feedback…" />
</Grid>
<Button>Send</Button>
</Flex>
<Theme accentColor="cyan" radius="full">
<Card size="2">
<Flex gap="6">
<Flex direction="column" gap="3">
<Heading as="h5" size="2">
Child
</Heading>
<Grid gap="1">
<Text as="div" weight="bold" size="2" mb="1">
Feedback
</Text>
<TextArea placeholder="Write your feedback…" />
</Grid>
<Button>Send</Button>
</Flex>
<Theme accentColor="orange">
<Card size="2">
<Flex direction="column" gap="3">
<Heading as="h5" size="2">
Grandchild
</Heading>
<Grid gap="1">
<Text as="div" weight="bold" size="2" mb="1">
Feedback
</Text>
<TextArea placeholder="Write your feedback…" />
</Grid>
<Button>Send</Button>
</Flex>
</Card>
</Theme>
</Flex>
</Card>
</Theme>
</Flex>
</Card>

コンポーネントのオーバーライド

サポートされているプロパティをそのコンポーネントに直接渡すことにより、コンポーネントごとに設定をオーバーライドします。

フィードバック
<Box maxWidth="400px">
<Card size="2">
<Flex direction="column" gap="3">
<Grid gap="1">
<Text as="div" weight="bold" size="2" mb="1">
Feedback
</Text>
<TextArea placeholder="Write your feedback…" />
</Grid>
<Flex asChild justify="between">
<label>
<Text color="gray" size="2">
Attach screenshot?
</Text>
<Switch size="1" color="orange" radius="full" defaultChecked />
</label>
</Flex>
<Grid columns="2" gap="2">
<Button variant="surface">Back</Button>
<Button color="cyan" radius="full">
Send
</Button>
</Grid>
</Flex>
</Card>
</Box>