Input
テキスト入力フィールド。様々なタイプ(text、email、password等)に対応。
インストール
import { Input } from "@ginga-ui/core";基本的な使い方
シンプルなテキスト入力フィールドです。
input.tsx
input.module.css
import { Input } from "@ginga-ui/core";
import styles from "./input.module.css";
export function BasicExample() {
return (
<Input
className={styles.basicInput}
aria-label="テキスト"
placeholder="テキストを入力..."
/>
);
}様々なタイプ
email、password、numberなど様々なタイプの入力フィールドです。
input.tsx
input.module.css
import { Input } from "@ginga-ui/core";
import styles from "./input.module.css";
export function TypesExample() {
return (
<div className={styles.typeList}>
<Input type="text" aria-label="テキスト" placeholder="テキスト" />
<Input
type="email"
aria-label="メールアドレス"
placeholder="メールアドレス"
/>
<Input type="password" aria-label="パスワード" placeholder="パスワード" />
<Input type="number" aria-label="数値" placeholder="数値" />
</div>
);
}無効化
無効化された入力フィールドです。
input.tsx
input.module.css
import { Input } from "@ginga-ui/core";
import styles from "./input.module.css";
export function DisabledExample() {
return (
<Input
className={styles.disabledInput}
disabled
aria-label="無効化された入力フィールド"
placeholder="無効化された入力フィールド"
/>
);
}初期値あり
初期値を持つ入力フィールドです。
input.tsx
input.module.css
import { Input } from "@ginga-ui/core";
import styles from "./input.module.css";
export function WithValueExample() {
return (
<Input
className={styles.valueInput}
aria-label="初期値の例"
defaultValue="初期値が設定されています"
/>
);
}Props
Input
React Aria の Input(新しいタブで開く) の props を受け取ります。