本文へスキップ
Ginga UI
Ginga UI
English

はじめに

  • 概要
  • クイックスタート
  • テーマ生成
  • 要素の差し替え
  • 全コンポーネント

フォーム

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

表示

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

タイポグラフィ

  • Heading
  • Paragraph

ナビゲーション

  • Anchor

レイアウト

  • Box

リソース

  • 変更履歴
  • GitHub(新しいタブで開く)

ロゴ: Twemoji(新しいタブで開く) (CC-BY 4.0)

Input

テキスト入力フィールド。様々なタイプ(text、email、password等)に対応。

Storybook で見る(新しいタブで開く)

インストール

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 を受け取ります。