Skip to content

Conversation

Copy link

Copilot AI commented Jul 27, 2025

This PR adds support for an IsInline property to the FormCheckboxTagHelper that allows checkboxes to be rendered horizontally instead of vertically stacked.

Changes Made

  • Added IsInline boolean property to FormCheckboxTagHelper with a default value of false
  • Enhanced CSS class building logic to append form-check-inline when IsInline is true
  • Full compatibility with existing features like IsSwitch - you can now have inline switch checkboxes
  • Comprehensive test coverage with 4 new tests covering all scenarios:
    • Default checkbox behavior
    • Inline checkbox behavior
    • Switch checkbox behavior
    • Inline switch checkbox behavior

Usage

<!-- Standard checkbox (vertical) -->
<form-checkbox asp-for="Item1"></form-checkbox>

<!-- Inline checkbox (horizontal) -->
<form-checkbox asp-for="Item2" is-inline="true"></form-checkbox>

<!-- Inline switch checkbox -->
<form-checkbox asp-for="Item3" is-inline="true" is-switch="true"></form-checkbox>

Visual Result

When IsInline="true" is set, the CSS class form-check-inline is added to the container div, making checkboxes display horizontally:

Checkbox Inline Demo

The screenshot shows the difference between:

  • "Select Your Options" - Standard vertical checkboxes
  • "Inline Options" - Horizontal inline checkboxes using is-inline="true"

Implementation Details

The implementation is minimal and follows the existing pattern used by the IsSwitch property. The CSS class building logic now includes:

if (IsInline)
{
    groupClass += " form-check-inline";
}

All 206 existing tests continue to pass, ensuring backward compatibility.

Fixes #55.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: mitchelsellers <5659113+mitchelsellers@users.noreply.github.com>
Copilot AI changed the title [WIP] Checkbox Support for Inline Add IsInline property support to FormCheckboxTagHelper Jul 27, 2025
Copilot AI requested a review from mitchelsellers July 27, 2025 21:48
Copilot finished work on behalf of mitchelsellers July 27, 2025 21:48
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.

Checkbox Support for Inline

2 participants