Repository navigation
feat(create-bestax): bestax-icons skill — teach agents the icon system #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // Skills → Examples → Icons: the bestax-icons skill's canonical example, | ||
| // rendered live. Shows the app-root ConfigProvider, meaningful-vs-decorative | ||
| // accessibility, sizes/variants/features, and multi-segment IconText. | ||
| import React from 'react'; | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
| import { ExampleMeta } from './ExampleMeta'; | ||
| import { ConfigProvider, Icon, IconText, Box, Button, Title } from '../index'; | ||
|
|
||
| const SKILL_HREF = | ||
| 'https://github.com/allxsmith/bestax/tree/main/skills/bestax-icons/SKILL.md'; | ||
|
|
||
| const meta: Meta = { | ||
| title: 'Skills/Icons', | ||
| tags: ['autodocs'], | ||
| parameters: { layout: 'padded' }, | ||
| }; | ||
| export default meta; | ||
| type Story = StoryObj; | ||
|
|
||
| function Meta_({ prompt }: { prompt: string }) { | ||
| return ( | ||
| <ExampleMeta | ||
| skill="bestax-icons" | ||
| skillHref={SKILL_HREF} | ||
| model="Claude Fable 5" | ||
| date="2026-07-14" | ||
| prompt={prompt} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export const IconUsage: Story = { | ||
| name: 'Icon usage & accessibility', | ||
| render: function IconUsageExample() { | ||
| return ( | ||
| <Box> | ||
| <Meta_ prompt="Add icons to my app: a warning indicator, a starred label, a save button, a loading spinner, and a metro-to-airport route line. Make them accessible." /> | ||
| {/* One library for the whole app — 'fa' | 'mdi' | 'ion' | | ||
| 'material-icons' | 'material-symbols' (Ionicons is 'ion', | ||
| NOT 'ionicons'). */} | ||
| <ConfigProvider iconLibrary="fa"> | ||
| <Title size="5">Meaningful icons carry their own label</Title> | ||
| <Icon | ||
| name="triangle-exclamation" | ||
| textColor="warning" | ||
| ariaLabel="Warning" | ||
| /> | ||
| <Icon name="circle-check" textColor="success" ariaLabel="Success" /> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Decorative icons hide from screen readers | ||
| </Title> | ||
| <IconText iconProps={{ name: 'star', 'aria-hidden': 'true' }}> | ||
| Starred | ||
| </IconText> | ||
| <Button color="primary" ml="3"> | ||
| <Icon name="floppy-disk" aria-hidden="true" /> | ||
| <span>Save</span> | ||
| </Button> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Sizes, variants, features, color | ||
| </Title> | ||
| <Icon | ||
| name="rocket" | ||
| size="large" | ||
| features="fa-2x" | ||
| ariaLabel="Launch" | ||
| /> | ||
| <Icon name="bell" variant="regular" ariaLabel="Notifications" /> | ||
| <Icon name="github" variant="brands" ariaLabel="GitHub" /> | ||
| <Icon | ||
| name="spinner" | ||
| features="fa-spin" | ||
| textColor="info" | ||
| ariaLabel="Loading" | ||
| /> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Multi-segment icon text | ||
| </Title> | ||
| <IconText | ||
| items={[ | ||
| { | ||
| iconProps: { name: 'train', 'aria-hidden': 'true' }, | ||
| text: 'Metro', | ||
| }, | ||
| { | ||
| iconProps: { name: 'arrow-right', 'aria-hidden': 'true' }, | ||
| text: 'Airport', | ||
| }, | ||
| ]} | ||
| /> | ||
| </ConfigProvider> | ||
| </Box> | ||
| ); | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| title: Icons | ||
| sidebar_label: Icons | ||
| sidebar_position: 5 | ||
| --- | ||
|
|
||
| # Icons skill | ||
|
|
||
| The [`bestax-icons`](https://github.com/allxsmith/bestax/blob/main/skills/bestax-icons/SKILL.md) | ||
| skill teaches an agent to use icons in an app built with `@allxsmith/bestax-bulma`: the | ||
| `Icon`/`IconText` components, the five supported icon libraries and their setup, the | ||
| per-library name formats and variants, and decorative-vs-labeled accessibility. | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| npx skills add https://github.com/allxsmith/bestax --skill bestax-icons | ||
| ``` | ||
|
|
||
| ## What it teaches | ||
|
|
||
| - **One library, set once** — `ConfigProvider iconLibrary` (`'fa' | 'mdi' | 'ion' | | ||
| 'material-icons' | 'material-symbols'`), so no per-`Icon` `library` prop. Including the | ||
| classic trap: the Ionicons value is **`'ion'`, not `'ionicons'`**. | ||
| - **Per-library name formats** — the same glyph is `rocket` (Font Awesome), | ||
| `rocket-launch` (MDI), and `rocket_launch` (Material Icons/Symbols, which render the name | ||
| as a font-ligature text node). The wrong format is the #1 cause of blank icons. | ||
| - **Variants and features** — Font Awesome's `solid`/`regular`/`brands`, Material Icons' | ||
| `round` vs Material Symbols' `rounded`, Ionicons' `outline`/`sharp` name suffixes, and | ||
| glyph scaling via `features` (`'fa-2x'`, `'fa-spin'`). | ||
| - **Accessibility** — a descriptive `ariaLabel` for meaningful standalone icons; | ||
| `aria-hidden` for decorative icons that sit next to visible text. | ||
|
|
||
| ## Meaningful vs decorative | ||
|
|
||
| ```tsx live | ||
| <Block> | ||
| <Icon name="triangle-exclamation" textColor="warning" ariaLabel="Warning" /> | ||
| <IconText iconProps={{ name: 'star', 'aria-hidden': 'true' }}> | ||
| Starred | ||
| </IconText> | ||
| </Block> | ||
| ``` | ||
|
|
||
| ## Sizes, variants, features | ||
|
|
||
| ```tsx live | ||
| <Block> | ||
| <Icon name="rocket" size="large" features="fa-2x" ariaLabel="Launch" /> | ||
| <Icon name="bell" variant="regular" ariaLabel="Notifications" /> | ||
| <Icon name="github" variant="brands" ariaLabel="GitHub" /> | ||
| <Icon | ||
| name="spinner" | ||
| features="fa-spin" | ||
| textColor="info" | ||
| ariaLabel="Loading" | ||
| /> | ||
| </Block> | ||
| ``` | ||
|
|
||
| ## Reference material the agent reads on demand | ||
|
|
||
| - [`references/icon-libraries.md`](https://github.com/allxsmith/bestax/blob/main/skills/bestax-icons/references/icon-libraries.md) | ||
| — per-library setup (npm package / CDN script), full name-format and variant tables, and | ||
| the blank-icon troubleshooting checklist. | ||
| - [`examples/icon-usage.tsx`](https://github.com/allxsmith/bestax/blob/main/skills/bestax-icons/examples/icon-usage.tsx) | ||
| — the canonical runnable example. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Icon API reference](../api/elements/icon.md) · [IconText API reference](../api/elements/icontext.md) | ||
| - [Configuration guide](../guides/features/configuration.md) — `ConfigProvider` in depth. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| --- | ||
| name: bestax-icons | ||
| description: Use icons in an app built with @allxsmith/bestax-bulma — the Icon/IconText components and the five supported libraries (Font Awesome, Material Design Icons, Ionicons, Google Material Icons, Material Symbols). Use when adding an icon, choosing or configuring the app-wide icon library, fixing an icon that renders blank, pairing icons with text, or making icons accessible (decorative vs labeled). | ||
| license: MIT | ||
| --- | ||
|
|
||
| # Icons with @allxsmith/bestax-bulma | ||
|
|
||
| `Icon` renders a Bulma icon container (`span.icon`) around a glyph from any of five icon | ||
| libraries behind one normalized API. `IconText` pairs icons with text. The library ships **no | ||
| icon fonts** — the chosen library's package (or CDN script) must be installed in the app. | ||
|
|
||
| ## Quick start | ||
|
|
||
| ```tsx | ||
| import { ConfigProvider, Icon, IconText } from '@allxsmith/bestax-bulma'; | ||
|
|
||
| // Set the library ONCE at the app root; <Icon> then never needs `library`. | ||
| <ConfigProvider iconLibrary="fa"> | ||
| <App /> | ||
| </ConfigProvider>; | ||
|
|
||
| // Inside the app: | ||
| <Icon name="rocket" ariaLabel="Launch" />; | ||
| <IconText iconProps={{ name: 'star', ariaLabel: 'Favorite' }}> | ||
| Starred | ||
| </IconText>; | ||
| ``` | ||
|
|
||
| ## The five libraries | ||
|
|
||
| | Library | `iconLibrary` / `library` value | Name format | Example `name` | | ||
| | ---------------------- | ------------------------------- | ---------------------------- | --------------- | | ||
| | Font Awesome (default) | `'fa'` | kebab-case, no `fa-` prefix | `rocket` | | ||
| | Material Design Icons | `'mdi'` | kebab-case, no `mdi-` prefix | `rocket-launch` | | ||
| | Ionicons | `'ion'` | kebab-case | `rocket` | | ||
| | Google Material Icons | `'material-icons'` | snake_case (a text ligature) | `rocket_launch` | | ||
| | Material Symbols | `'material-symbols'` | snake_case (a text ligature) | `rocket_launch` | | ||
|
|
||
| ⚠️ **The Ionicons value is `'ion'`, not `'ionicons'`.** The `npm create bestax` scaffold's | ||
| `--icon ionicons` flag maps to `iconLibrary="ion"` — passing `'ionicons'` to `ConfigProvider` | ||
| or `library` silently renders nothing. | ||
|
|
||
| **The same glyph has a different name per library** (`rocket` vs `rocket-launch` vs | ||
| `rocket_launch`). When an icon renders blank, the name format for the active library is the | ||
| first thing to check. A redundant `fa-`/`mdi-` prefix in `name` is tolerated (stripped), but | ||
| don't rely on it. | ||
|
|
||
| ## Styling | ||
|
|
||
| - `size` — `'small' | 'medium' | 'large'` sizes the Bulma **container** (`is-small` ≈ 1rem, | ||
| `is-medium` ≈ 2rem, `is-large` ≈ 3rem box). To scale the **glyph**, use `features` | ||
| (Font Awesome `'fa-lg'`/`'fa-2x'`) or a Bulma text-size class (`'is-size-3'`). | ||
| - `variant` — per-library style: Font Awesome `solid` (default) / `regular` / `brands` / | ||
| `light` / `duotone` / `thin`; Material Icons `filled` (default) / `outlined` / `round` / | ||
| `sharp`; Material Symbols `outlined` (default) / `rounded` / `sharp`; Ionicons `outline` / | ||
| `sharp`. MDI has no variants. Note Material **Icons** uses `round`, Material **Symbols** | ||
| uses `rounded`. | ||
| - `features` — extra library classes, string or array: `'fa-spin'`, `['fa-lg', 'fa-border']`. | ||
| - Color via the helper props: `textColor="primary"`, `textColor="danger"`, etc. | ||
|
|
||
| ## Accessibility | ||
|
|
||
| Every `Icon` renders `aria-label` (default `"icon"`). | ||
|
|
||
| - **Meaningful icon** (stands alone, conveys information): pass a descriptive | ||
| `ariaLabel="Delete item"`. | ||
| - **Decorative icon** (next to visible text that says the same thing, e.g. inside `IconText` | ||
| or a labeled `Button`): hide it from screen readers with `aria-hidden`: | ||
| `<Icon name="check" aria-hidden="true" />` — otherwise "icon" (or a duplicate label) is | ||
| announced alongside the text. | ||
|
|
||
| ## References | ||
|
|
||
| - `references/icon-libraries.md` — per-library setup (install/import/CDN), the full | ||
| name-format and variant tables, `features` values, and the blank-icon troubleshooting list. | ||
| - `examples/icon-usage.tsx` — runnable example: ConfigProvider setup, sizes, variants, | ||
| colors, IconText, and decorative-vs-labeled patterns. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Icons with @allxsmith/bestax-bulma — the canonical patterns. | ||
| // | ||
| // The app must load the icon library itself (bestax ships no icon fonts): | ||
| // here Font Awesome, via `npm install @fortawesome/fontawesome-free` and | ||
| // `import '@fortawesome/fontawesome-free/css/all.min.css';` in main.tsx. | ||
| // Set the library ONCE on ConfigProvider ('fa' | 'mdi' | 'ion' | | ||
| // 'material-icons' | 'material-symbols' — Ionicons is 'ion', NOT 'ionicons'); | ||
| // every <Icon> below then omits `library`. | ||
| import React from 'react'; | ||
| import { | ||
| ConfigProvider, | ||
| Icon, | ||
| IconText, | ||
| Button, | ||
| Box, | ||
| Title, | ||
| } from '@allxsmith/bestax-bulma'; | ||
|
|
||
| export function IconShowcase() { | ||
| return ( | ||
| <ConfigProvider iconLibrary="fa"> | ||
| <Box> | ||
| <Title size="5">Meaningful icons carry their own label</Title> | ||
| {/* Standalone icons convey information — give them a descriptive | ||
| ariaLabel (the default is just "icon"). */} | ||
| <Icon | ||
| name="triangle-exclamation" | ||
| textColor="warning" | ||
| ariaLabel="Warning" | ||
| /> | ||
| <Icon name="circle-check" textColor="success" ariaLabel="Success" /> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Decorative icons hide from screen readers | ||
| </Title> | ||
| {/* Next to visible text the icon repeats the message — aria-hidden | ||
| stops "icon" (or a duplicate) being announced. */} | ||
| <IconText iconProps={{ name: 'star', 'aria-hidden': 'true' }}> | ||
| Starred | ||
| </IconText> | ||
| <Button color="primary"> | ||
| <Icon name="floppy-disk" aria-hidden="true" /> | ||
| <span>Save</span> | ||
| </Button> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Sizes, variants, features, color | ||
| </Title> | ||
| {/* `size` sizes the Bulma container; `features` scales the glyph. */} | ||
| <Icon name="rocket" size="large" features="fa-2x" ariaLabel="Launch" /> | ||
| {/* Font Awesome styles come from `variant`; brands require it. */} | ||
| <Icon name="bell" variant="regular" ariaLabel="Notifications" /> | ||
| <Icon name="github" variant="brands" ariaLabel="GitHub" /> | ||
| {/* Spin + color via features and the textColor helper. */} | ||
| <Icon | ||
| name="spinner" | ||
| features="fa-spin" | ||
| textColor="info" | ||
| ariaLabel="Loading" | ||
| /> | ||
|
|
||
| <Title size="5" mt="4"> | ||
| Multi-segment icon text | ||
| </Title> | ||
| <IconText | ||
| items={[ | ||
| { | ||
| iconProps: { name: 'train', 'aria-hidden': 'true' }, | ||
| text: 'Metro', | ||
| }, | ||
| { | ||
| iconProps: { name: 'arrow-right', 'aria-hidden': 'true' }, | ||
| text: 'Airport', | ||
| }, | ||
| ]} | ||
| /> | ||
| </Box> | ||
| </ConfigProvider> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.