Skip to content

Conversation

@albx
Copy link
Owner

@albx albx commented Jan 10, 2026

This pull request introduces the new BitToggle component, a modern toggle switch for boolean input, to the BitBlazor form library. It includes the implementation, documentation, usage examples, storybook stories, and a comprehensive set of tests. The component provides a visual alternative to checkboxes, supports inline/grouped layouts, integrates with form validation, and is fully documented and tested.

Component Implementation

  • Added the new BitToggle component in src/BitBlazor/Form/Toggle/BitToggle.razor and its code-behind, supporting boolean values, inline/grouped display modes via the new ToggleViewMode enumeration, accessibility features, and form validation integration. [1] [2] [3]

Documentation and Usage

  • Updated documentation to include BitToggle in the form components overview and provided a dedicated usage guide with detailed examples and parameter descriptions in docs/form/toggle.md. [1] [2] [3]
  • Added quick reference examples for BitToggle in docs/quick-reference.md and documented the new ToggleViewMode enumeration in docs/enumerations.md. [1] [2]

Storybook Integration

  • Created comprehensive Storybook stories for BitToggle in stories/BitBlazor.Stories/Components/Stories/Form/BitToggle.stories.razor, showcasing its features, layouts, disabled state, and additional text support.

Testing

  • Added behavior and rendering tests for BitToggle to ensure correct value changes, markup output, disabled state, layouts, and additional text rendering in tests/BitBlazor.Test/Form/Toggle/BitToggleTest.Behaviors.cs and tests/BitBlazor.Test/Form/Toggle/BitToggleTest.Rendering.razor. [1] [2]

Related Improvements

  • Updated BitCheckbox to render validation messages consistently, aligning with the new toggle component’s design.

@albx albx linked an issue Jan 10, 2026 that may be closed by this pull request
@albx albx marked this pull request as ready for review January 11, 2026 21:14
@albx albx requested a review from Copilot January 11, 2026 21:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces the BitToggle component, a modern toggle switch for boolean input in the BitBlazor form library. The component provides a visual alternative to checkboxes with support for inline/grouped layouts, form validation, and comprehensive documentation.

Changes:

  • Added new BitToggle component with code-behind, markup, and ToggleViewMode enumeration
  • Comprehensive documentation including usage guide, quick reference, and enumeration docs
  • Storybook stories showcasing various features and layouts
  • Test suite covering behaviors and rendering scenarios
  • Updated BitCheckbox to include validation message rendering

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/BitBlazor/Form/Toggle/BitToggle.razor Component markup implementing toggle switch with validation and accessibility
src/BitBlazor/Form/Toggle/BitToggle.razor.cs Code-behind with ViewMode parameter and CSS class computation
src/BitBlazor/Form/Toggle/ToggleViewMode.cs Enumeration defining Inline and Grouped display modes
tests/BitBlazor.Test/Form/Toggle/BitToggleTest.Behaviors.cs Behavior test for value changes
tests/BitBlazor.Test/Form/Toggle/BitToggleTest.Rendering.razor Rendering tests for markup, disabled state, view modes, and additional text
stories/BitBlazor.Stories/Components/Stories/Form/BitToggle.stories.razor Storybook stories demonstrating component features
docs/form/toggle.md Complete usage documentation with examples and parameters
docs/quick-reference.md Quick reference examples for BitToggle
docs/form/form-components.md Updated component list to include BitToggle
docs/enumerations.md Documentation for ToggleViewMode enumeration
docs/README.md Updated main documentation with BitToggle overview
src/BitBlazor/Form/Checkbox/BitCheckbox.razor Added validation message rendering for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@albx albx merged commit 11dbe64 into main Jan 12, 2026
11 checks passed
@albx albx deleted the feature/40-toggle-component branch January 12, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add toggle component

2 participants