Skip to content

feat(Accordion): support emoji icon#1492

Open
kevinports wants to merge 3 commits into
nextfrom
feat/accordion/support-emoji
Open

feat(Accordion): support emoji icon#1492
kevinports wants to merge 3 commits into
nextfrom
feat/accordion/support-emoji

Conversation

@kevinports
Copy link
Copy Markdown
Contributor

@kevinports kevinports commented May 27, 2026

🎫 Resolve ISSUE_ID

🎯 What does this PR do?

Adds emoji icon support to the Accordion component alongside existing Font Awesome icon support.

This is necessary because the new WYSIWYG accordion UI in our editor supports selecting both Font Awesome and emoji icons https://github.com/readmeio/readme/pull/19025

🧪 QA tips

Paste each snippet into a ReadMe doc and confirm the accordion renders correctly.

Emoji icon

<Accordion icon="🚀" title="Emoji Icon">
Content inside the accordion.
</Accordion>
  • A 🚀 emoji appears to the left of the title
  • The accordion opens/closes on click

Font Awesome icon (existing behavior, no regression)

<Accordion icon="fa-book" title="FA Icon">
Content inside the accordion.
</Accordion>
  • A duotone book icon appears to the left of the title

Font Awesome icon with color (no regression)

<Accordion icon="fa-star" iconColor="red" title="Colored Icon">
Content inside the accordion.
</Accordion>
  • Icon renders in red; emoji icons are unaffected by iconColor

No icon (no regression)

<Accordion title="No Icon">
Content inside the accordion.
</Accordion>
  • No icon element rendered, title appears alone

📸 Screenshot or Loom

Comment on lines +5 to +6
/** @see https://docs-v5.fontawesome.com/web/reference-icons */
const FA_PREFIXES = new Set(['fab', 'fad', 'far']);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We use the @ui/EmojiPicker component in the Accordion wysiwyg block in the MdxishEditor in the monorepo. @ui/EmojiPicker allows a user to select between solid and duotone font awesome variants and will emit values with these class prefixes to differentiate those variants.

So the icon prop could receive values like fad fa-smile or far fa-smile instead of just fa-smile.

Accounting for that here and falling back to duotone if no prefix is provided.

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.

do we not need to support fal and fas as well?

@kevinports kevinports marked this pull request as ready for review May 27, 2026 20:19
Copy link
Copy Markdown
Contributor

@maximilianfalco maximilianfalco left a comment

Choose a reason for hiding this comment

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

lgtm! tested this both in the monorepo and the demo app and they both work nicely! just one non blocking question about the FA prefixes!

Comment on lines +5 to +6
/** @see https://docs-v5.fontawesome.com/web/reference-icons */
const FA_PREFIXES = new Set(['fab', 'fad', 'far']);
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.

do we not need to support fal and fas as well?

Copy link
Copy Markdown
Contributor

@eaglethrost eaglethrost left a comment

Choose a reason for hiding this comment

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

@kevinports Did some quick fontawesome research and I think you need to also include 'fas', 'fal', 'fat' in the FA_PREFIXES as well as it won't render the icon anymore.

Given these accordions:

<Accordion icon="fas fa-star" title="Solid star (fas)">
</Accordion>

<Accordion icon="fal fa-book" title="Light book (fal)">
</Accordion>

<Accordion icon="fat fa-bell" title="Thin bell (fat)">
</Accordion>

Before:
Screenshot 2026-05-28 at 11 20 23 am

After:
Screenshot 2026-05-28 at 11 20 31 am

Other than that, the changes work nicely!

<details className="Accordion" onToggle={() => setIsOpen(!isOpen)}>
<summary className="Accordion-title">
<i className={`Accordion-toggleIcon${isOpen ? '_opened' : ''} fa fa-regular fa-chevron-right`}></i>
{icon && <i className={`Accordion-icon fa-duotone fa-solid ${icon}`} style={{ color: `${iconColor}` }}></i>}
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.

Is it fine to not have the fa-duotone class anymore?

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