Skip to content

feat(RadioList): render custom content as the radio [TEM-479]#2809

Closed
mikeyrayvon wants to merge 3 commits into
mainfrom
feat/radiolist-custom-radio-content
Closed

feat(RadioList): render custom content as the radio [TEM-479]#2809
mikeyrayvon wants to merge 3 commits into
mainfrom
feat/radiolist-custom-radio-content

Conversation

@mikeyrayvon

@mikeyrayvon mikeyrayvon commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

📖 Background

Templates has two new cases where a radiogroup is the appropriate role for a custom form element. Instead of building a bespoke component behaving as an accessible radio group, we would like to benefit from the Fondue RadioList, but use our own custom card component as the RadioButton.

Today RadioButton hardcodes the <Indicator> dot as its only child, so asChild merges onto the dot rather than a card.

🎯 What does this PR do?

Lets a RadioList.RadioButton render your own element as the radio instead of the built-in dot. Pass children to replace the dot indicator, or asChild to make a consumer element (e.g. a large selectable card) be the radio — it still gets the radio role, checked state, roving tab order, and arrow-key navigation from the primitive. Existing radios (no children/asChild) are unchanged.

🧪 How to test

  • Storybook → Components/RadioList → AsSelectableCards: click a card and arrow-key between them; only one is selected at a time and focus follows selection (single tab stop).
  • Confirm the existing stories (Default, Vertical, Disabled, …) still render the standard radio dot.
  • Style the selected state via the data-state="checked" attribute the primitive sets (shown in the story).

🖼️ Screenshots

Storybook:

image

Use cases:

image image

📌 Related tickets & additional notes

  • TEM-479
  • In asChild mode the default styles.item dot styling is intentionally skipped so it doesn't fight the consumer's element; the consumer owns styling (and focus visuals) via data-state. Backwards-compatible — the change is purely additive.

RadioButton now renders its children in place of the default dot indicator
and honours asChild, so a consumer element becomes the radio itself while
keeping the radio role, checked state, roving tab order, and arrow-key
navigation from the underlying primitive. Enables patterns like large
selectable cards. Existing usages without children/asChild are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikeyrayvon mikeyrayvon self-assigned this Jul 23, 2026
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6df2af8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@frontify/fondue-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mikeyrayvon mikeyrayvon changed the title feat(RadioList): render custom content as the radio via children/asChild feat(RadioList): render custom content as the radio [TEM-479] Jul 23, 2026
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for fondue-components ready!

Name Link
🔨 Latest commit 77b30ce
🔍 Latest deploy log https://app.netlify.com/projects/fondue-components/deploys/6a6206066303590008b61d2c
😎 Deploy Preview https://deploy-preview-2809.components.fondue-components.frontify.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

mikeyrayvon and others added 2 commits July 23, 2026 14:15
Runs useId inside a named React component instead of the story's render
callback, resolving the rules-of-hooks finding on the new story.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikeyrayvon
mikeyrayvon marked this pull request as ready for review July 23, 2026 12:16
@mikeyrayvon
mikeyrayvon requested a review from a team as a code owner July 23, 2026 12:16
@mikeyrayvon
mikeyrayvon requested a review from syeo66 July 23, 2026 12:16
@noahwaldner

Copy link
Copy Markdown
Contributor

I'm not sure if this is something that really needs to be in fondue.

@mikeyrayvon do you know if the designers had an alignemnt on this?

@@ -0,0 +1,33 @@
/* (c) Copyright Frontify Ltd., all rights reserved. */

.card {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for story examples we use tailwind

@noahwaldner

Copy link
Copy Markdown
Contributor

I had a call with @mikeyrayvon and we will pause this until johanna is back to discuss the addition of a "card" variant, to avoid accepting custom components

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