Skip to content

Conversation

@koppen
Copy link
Member

@koppen koppen commented Jan 9, 2026

The API of Flowbite::InputField::RadioButton should follow the same structure as the other components for hints.

Instead of passing a String

`hint: "This is the hint"

you now have to pass a Hash that's passed along to the Hint component

hint: {content: "This is the hint"}

This allows consumers to customize other options (eg HTML attributes like class) in addition to the hint text.

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 PR updates the RadioButton component's hint API to align with other input field components. Instead of accepting a String value for hints, the component now expects a Hash that allows for both content and additional options to be passed to the underlying Hint component.

  • Changed RadioButton hint parameter from String to Hash format (breaking change)
  • Updated implementation to match Checkbox component pattern by removing custom hint method and using inherited default_hint behavior
  • Updated existing tests to use new Hash-based hint API

Reviewed changes

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

File Description
app/components/flowbite/input_field/radio_button.rb Removed custom hint method and added default_hint_options override to support Hash-based hint API with custom classes
test/components/input_field/radio_button_test.rb Updated hint tests to use new Hash format with {content: "..."} structure
CHANGELOG.md Documented the breaking change with migration guidance
Comments suppressed due to low confidence (1)

test/components/input_field/radio_button_test.rb:58

  • Missing test coverage for passing custom options to the hint. The new API allows passing options like hint: {content: "...", options: {title: "Hint"}}, but there's no test verifying this works. Consider adding a test similar to test_passes_options_to_the_hint in checkbox_test.rb (line 79-83).
  def test_renders_a_hint
    render_inline(Flowbite::InputField::RadioButton.new(form: @form, attribute: :state, value: "visible", hint: {content: "Profile can be accessed publicly"}))

    assert_selector("p.text-xs.font-normal.text-body", text: "Profile can be accessed publicly")
  end

  def test_adds_aria_attributes_for_hint
    render_inline(Flowbite::InputField::RadioButton.new(form: @form, attribute: :state, hint: {content: "Profile can be accessed publicly"}, value: "visible"))

    assert_selector("input[aria-describedby='article_state_visible_hint']")
    assert_selector("p#article_state_visible_hint", text: "Profile can be accessed publicly")
  end

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

@koppen koppen force-pushed the radiobutton_hint_api branch from ccf3f28 to 4f1c79e Compare January 9, 2026 08:32
@koppen koppen requested review from RasmusDWN and olepalm January 9, 2026 08:32
The API of Flowbite::InputField::RadioButton should follow the same
structure as the other components for hints.

Instead of passing a String

    `hint: "This is the hint"

you now have to pass a Hash that's passed along to the Hint component

    hint: {content: "This is the hint"}

.

This allows consumers to customize other options (eg HTML attributes
like class) in addition to the hint text.
@koppen koppen force-pushed the radiobutton_hint_api branch from 4f1c79e to 38990b4 Compare January 9, 2026 08:35
@koppen koppen merged commit b39bc4d into main Jan 9, 2026
5 checks passed
@koppen koppen deleted the radiobutton_hint_api branch January 9, 2026 08:47
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.

3 participants