フォーム v1.0.0

スイッチ

ブーリアンのオン/オフ状態を切り替えるトグルスイッチコントロール。 フォームビルダーモード(Railsフォームオブジェクト利用)とスタンドアロンの両方に対応しています。 ラベル、説明、複数サイズを含みます。

プレビュー & コード

オプション

名前 デフォルト 説明
form FormBuilder nil Rails form builder object (for form builder mode)
attribute Symbol nil Model attribute name (for form builder mode)
name String nil Input name attribute (for standalone mode)
checked Boolean false Whether the switch is initially on
label String nil Label text (auto-generated from attribute if not provided)
description String nil Additional description text below the label
size Symbol :md Switch size: :sm, :md, or :lg
disabled Boolean false Whether the switch is disabled
error String nil Manual error message (auto-detected from form object if not provided)
class String "" Additional CSS classes for the container

変更履歴 v1.0.0

- Initial release with form builder and standalone modes
- Three size options: sm, md (default), lg
- Smooth toggle animation via Stimulus controller
- Automatic error detection from Rails form objects
- Dark mode support

フルアクセスを取得

このコンポーネントと他のすべてのソースコードをアンロックしましょう。一回のお支払いで永久アクセス。

今すぐアクセスを取得