Index of every page on this site: llms.txt
All skills
allxsmith avatar

/bestax-migrate

@9cf369a
by Alex Smithallxsmith/bestax15 stars
2
Run it yourself

Migrate an existing React app to @allxsmith/bestax-bulma on Bulma v1, from raw Bulma CSS classes on plain JSX (className="button is-primary") or in static HTML pages and templates styled with Bulma, or from an unmaintained React Bulma library (react-bulma-components v4, rbx v2, bloomer 0.6). Run the bestax-migrate codemod, then resolve every TODO(bestax-migrate) comment it leaves using the per-source mapping references. Use when a React app styles its markup with Bulma classes and wants bestax components instead, when static HTML pages or templates styled with Bulma should become React components, when a repo imports react-bulma-components, rbx or bloomer, when TODO(bestax-migrate) comments are present in a codebase, or when asked to convert Bulma classNames to bestax-bulma.

Use this Skill: https://skilld.dev/gh/allxsmith/bestax/bestax-migrate

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesreact-bulma-componentsunmappables.md

≈5.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Recipes for every TODO(bestax-migrate) the codemod leaves

Work through grep -rn "TODO(bestax-migrate)" src/ with these. Delete each comment once the site is converted.

unsupported-file — .astro / .vue / .svelte / .mdx imports

The codemod can't parse these formats, so files in them that import react-bulma-components are reported (not rewritten). Migrate them by hand: swap the import to @allxsmith/bestax-bulma and apply the same renames the component/prop maps describe — the mapping is identical, only the rewriting is manual.

peer-deps — install-blocking version conflicts

Reported from package.json, not a code TODO. bestax-bulma's peers: React ^18 || ^19 (upgrade react/react-dom before installing — RBC v4 also ran on 17) and optional @fortawesome/fontawesome-free ^6.7 || ^7 (FA 5 apps: upgrade, or npm install --legacy-peer-deps and keep FA 5 for your own <i> tags).

component:Element — no generic element

bestax has no Element. Pick the semantic component (Block, Box, Content, …) that matches the usage, or plain JSX with classes:

// Before
<Element renderAs="span" textColor="grey" m={2}>…</Element>
// After
<Span textColor="grey" m="2">…</Span>   // bestax exports Span/Paragraph/Strong/etc.

component:Tile — Bulma v1 replaced tiles with Grid

Convert ancestor/parent/child tile trees to Grid/Cell (docs: https://bestax.io/docs/api/grid):

// Before
<Tile kind="ancestor"><Tile kind="parent" size={8}><Tile kind="child">A</Tile></Tile></Tile>
// After
<Grid><Cell colSpan={8}>A</Cell></Grid>

Match the old proportions with Cell span props; tiles' vertical becomes grid flow.

component:Heading — Bulma v1 dropped .heading

A Heading with a truthy heading is Bulma 0.9's small uppercase label, and bestax has no component for it. It becomes the plain element RBC rendered: an <h1>, or the tag a literal renderAs names, with className="heading", plus is-<size> and has-text-weight-<weight> for a literal size and weight (<Heading heading size={6} weight="bold"> becomes <h1 className="heading is-6 has-text-weight-bold">). Bulma v1 has no rule for heading, so that class styles nothing. The <h1> keeps the label in the page's heading outline, as RBC had it.

Where the label isn't really a heading, restyle it with helper props, as a small, uppercase, semibold Paragraph:

<Heading heading>Followers</Heading>
<Paragraph textSize="7" textTransform="uppercase" textWeight="semibold" mb="1">
  Followers
</Paragraph>

Or keep the element and give the class a rule of your own. Bulma 0.9's was:

.heading {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

prop:renderAs — an element the codemod can't read

Where a component becomes plain markup, a literal renderAs names the element written. One the codemod can't read leaves the element RBC rendered by default, with this TODO, so render the tag you meant yourself.

prop:size, prop:weight on a heading label

A size or weight the codemod can't read stays off the label's plain element, with a TODO. Add the classes RBC wrote for them by hand:

<Heading heading size={size} weight={weight}>Tweets</Heading>
<h1 className={`heading is-${size} has-text-weight-${weight}`}>Tweets</h1>

Controlled Dropdown (value / onChange, Dropdown.Item value)

bestax Dropdown is compositional — you own the selection state:

const [choice, setChoice] = useState('a');
<Dropdown label={labels[choice]} closeOnClick>
  <Dropdown.Item active={choice === 'a'} onClick={() => setChoice('a')}>
    First
  </Dropdown.Item>
  <Dropdown.Item active={choice === 'b'} onClick={() => setChoice('b')}>
    Second
  </Dropdown.Item>
</Dropdown>;

Dropdown color (prop:color)

react-bulma-components gave a Dropdown's color to its trigger button. bestax's Dropdown has no prop for its trigger's color, and its own color is the text color helper on the root, so the codemod leaves color with a TODO: remove it.

Pagination extras (showFirstLast, showPrevNext, autoHide)

bestax Pagination renders from total/current/onPageChange when it has no children: Previous, Next and the page links, with an ellipsis for each run it skips. The codemod writes delta as siblingCount (the pages on each side of the current one) and next/previous as nextLabel/previousLabel. It always shows Previous and Next, and the first and last pages (boundaryCount of each, 1 by default), so drop showPrevNext and showFirstLast, or compose the parts (Pagination.Previous, Pagination.List, Pagination.Link) by hand for a different layout. Render conditionally instead of autoHide ({total > 1 && <Pagination …/>}).

Two of RBC's defaults differ, and a Pagination that doesn't write them gets no TODO: RBC hides itself at a total of 1 (autoHide is on by default), and shows no first and last pages unless showFirstLast is set. bestax renders a one-page Pagination with both ends disabled, and shows the first and last pages, so check pagination that relied on either. RBC's delta={0} renders no page links at all, while siblingCount={0} still shows the current, first and last pages, so that one value gets a prop:delta TODO rather than converting.

Modal (closeOnBlur, showClose)

closeOnEsc is not in this list: bestax has closeOnEscape (default true) and the codemod renames it, so closeOnEsc={false} keeps suppressing Escape rather than inheriting the default.

The other two depend on which form the migrated modal lands in. bestax's Modal supplies a background wired to onClose and a floating close button only in its legacy form — plain children, no compound child. A Modal.Content or Modal.Card child (which is what almost every RBC modal has) selects the compound form, and that renders only the children you wrote:

<Modal active={show} onClose={close} aria-label="Edit profile">
  <Modal.Background onClick={close} />
  <Modal.Content>…</Modal.Content>
  <Modal.Close variant="floating" onClick={close} />
</Modal>

So closeOnBlur and showClose={true} mean "add those two children"; passing either as false means "drop the prop", since the compound form gives you neither unless you ask. The open modal is a dialog, so give it a name too, with aria-label, or aria-labelledby pointing at its title (name:Modal).

responsive — touch / untilWidescreen / untilFullhd / { only: true } breakpoints

No bestax helper-prop variants exist. Use Bulma classes directly: className="is-hidden-touch", is-flex-tablet-only, etc. (all still exist in Bulma v1).

Icon children the parser couldn't read

bestax Icon renders from name + library (+ variant for Font Awesome styles):

<Icon name="github" library="fa" variant="brands" ariaLabel="GitHub" />

For icon fonts other than Font Awesome/MDI, see the bestax-icons skill.

Dynamic values (state={x}, textSize={n}, align={side}, …)

The codemod only rewrites literals. Convert the expression at its source, e.g.:

// Before: <Button state={hovered ? 'hover' : undefined}>
<Button isHovered={hovered}>
// Before: <Block textSize={n}>
<Block textSize={String(n) as '1' | '2' | '3' | '4' | '5' | '6' | '7'}>

prop:color — Button shade colors (black-bis, grey-light, …) and isSelected

bestax Button colors are the semantic set + text/ghost. For shades use bgColor/textColor (they accept the full palette incl. shades), and replace isSelected with className="is-selected" inside grouped buttons.

colorVariant / Hero gradient / Hero halfheight (prop:size)

  • colorVariant="light" on a Notification, a Tag or a Button that stays one (not remove, which becomes Delete) becomes isLight, unless a spread after it could override it. Any other case is flagged: react-bulma-components rendered the value as the is-light or is-dark class, so add that class to className, or use a shade such as bgColor="primary" backgroundColorShade="90".
  • Bulma v1 removed is-bold hero gradients — delete gradient or restyle with CSS.
  • halfheight has no bestax size; use size="medium" or a CSS height.

prop:backgroundColor — a component with no background color prop

backgroundColor becomes bgColor, or stays backgroundColor on a component that takes only that. Notification, Table and its parts, Tabs, Checkbox, Radio, Progress, the Modal.Card parts and the other components that take neither keep it as written with a TODO: move the color to a has-background-* class in className.

prop:textColor — a component with no textColor prop

textColor carries over as written, and becomes color on Table (and its Thead, Tbody and Tfoot), Menu and its parts, and Dropdown and its Item, whose color sets the text, when the value is one of bestax's color names. On the other components with no textColor, such as Tag, Tabs, Hero, Progress, Breadcrumb, Input, Select, TextArea, File and the Modal.Card parts, it stays with a TODO: move the color to a has-text-* class in className. On the components where it becomes color, it also stays with a TODO where the element already sets color or has a spread, or the value is dynamic, a shade or text: use color with colorShade for a shade, or the class.

A size bestax doesn't take (prop:size on Button.Group and Message)

Button.Group and Message sizes carry over as written when bestax's Buttons or Message takes the value. Any other value, or one the codemod can't read, stays as written with a TODO that lists the sizes that component takes: use one of them, or drop the prop.

prop:size on Heading: a size the codemod cannot carry

RBC's Heading rendered an <h1> at every size, subtitle or not. bestax's Title and SubTitle render the heading their size names unless as="p", so a literal size moves to textSize to keep the level (see "Heading sizes" in the prop map). A dynamic one cannot move, because textSize takes a string, so it stays size. Pass it to textSize yourself:

<Heading size={compact ? 5 : 4}>Report</Heading>
<Title textSize={compact ? '5' : '4'}>Report</Title>

A literal outside 1 to 7 has no Bulma class, and bestax renders none for it either: drop it, or set a textSize from '1' to '7'.

The same TODO marks a Heading that sets size and textSize both: drop size and let textSize set the font size.

name:Table — a responsive table with no name

Table.Container folded into isResponsive on a Table with no aria-label and no aria-labelledby. While the table overflows, Table isResponsive makes its container a region you can tab to, named by those two alone, and a development build warns when it has neither. Look for a name the container carried in a TODO beside this one (prop:aria-label, or prop:spread for one in a spread). Otherwise give the Table an aria-label, or point aria-labelledby at a heading, or at its <caption>'s id when it has one.

The container's role and tabIndex go with it (prop:role, prop:tabIndex): Table isResponsive writes them on its container itself while the table overflows. When the Table already names itself, with an attribute of its own or a <caption>, the container's name goes with the container too (prop:aria-label, prop:aria-labelledby), so check that the Table's is the one you want.

name:Modal: a modal with no name

A converted Modal with no aria-label or aria-labelledby, and no spread that could hold one. bestax's Modal is a dialog while it's open, and a dialog with no name is announced as just "dialog". Only the legacy form's modalCardTitle names it for you, and the codemod never writes that. Give the Modal an aria-label, or point aria-labelledby at the id of its title, such as its Modal.Card.Title when it has one:

<Modal active={show} onClose={close} aria-labelledby="terms-title">
  <Modal.Background onClick={close} />
  <Modal.Card>
    <Modal.Card.Head>
      <Modal.Card.Title id="terms-title">Terms</Modal.Card.Title>
    </Modal.Card.Head>
    <Modal.Card.Body>…</Modal.Card.Body>
  </Modal.Card>
</Modal>

domRef

bestax components don't take domRef, but many forward a plain ref — the form controls, plus Affix, AppFrame, AppFrame.Aside, AppFrame.Burger, AppFrame.Footer, AppFrame.Header, AppFrame.Main, AppFrame.Nav, Avatar, Button, Carousel, CarouselItem, Center, ColorSwatch, Command, Command.Dialog, Command.Input, CopyButton, DataTable, DescriptionList, DescriptionList.Item, DescriptionList.Label, DescriptionList.Value, Dialog, Dropdown, EmptyState, Flex, FloatButton, FloatButton.BackToTop, FloatButton.SpeedDial, FloatButtons, Group, IconButton, Kbd, Kbd.Group, Lightbox, Lightbox.Trigger, Link, LinkButton, Loader, LocaleProvider, Menu.Item, Modal, Navbar, Navbar.Burger, Navbar.Dropdown, Navbar.Item, Navbar.Link, NumberFormatter, RingProgress, ScrollArea, SegmentedControl, SegmentedControl.Segment, Sidebar, Splitter, Splitter.Pane, Stack, Stat, Stat.Change, Stat.Description, Stat.Label, Stat.Value, Stats, TableOfContents, Timeline, Timeline.Item, Toast, ToggleButton, Tour, Tour.Back, Tour.Next, Tour.Skip, Tour.Step, TreeView and TreeView.Item. On those, rename domRef to ref and it works; do not restructure the markup. "The form controls" means the inputs themselves: the Field, Field.Label, Field.Body, Checkboxes and Radios wrappers around them forward nothing, and Field is a target this codemod emits.

Everywhere else the rename is not enough, and the two React majors differ: React 18 drops the ref and logs "Function components cannot be given refs", while React 19 passes it through as an ordinary prop, so it settles wherever the component spreads its rest props with nothing logged. bestax supports both, so attach the ref to a DOM element inside, or wrap the component in a <div ref={…}>.

The codemod does not do that rename for you: domRef is flagged on every component, so the TODO names both cases and you pick. Navbar.Dropdown is the trap, and it cuts both ways — RBC's is the menu itself, so it maps to bestax's Navbar.DropdownMenu, which forwards no ref; bestax reserves the name Navbar.Dropdown for the outer container, which is what the Navbar.Item wrapping your dropdown becomes, and that one does forward one. So after the codemod runs, read the target name on the line, not the one you wrote.

Button has the same shape of trap. <Button remove> is Bulma's delete cross, so it migrates to <Delete>, a plain function component that forwards no ref — even though Button itself does. The codemod detects that case and replaces the general advice with a TODO naming Delete, so the message on the line is the one to trust.

prop:as — a tag the component does not render

Several bestax components accept as but narrow it to the tags Bulma's markup allows there, so a literal renderAs outside that union (<Media renderAs="section">, <Footer renderAs="section">) becomes a prop:as TODO listing the tags that component does render. Wrap the component in the element you wanted, or restructure. See the as section of prop-map.md for which components accept it at all.

prop:href — a link needs the anchor

bestax gives an element the attributes of the tag as names, so an href belongs on an <a> or on a custom component you pass to as, never on another intrinsic tag. RBC let the two disagree, and the browser ignored the result: <Menu.List.Item renderAs="span" href="/x"> rendered a <span> that navigated nowhere. The element stays, the dead attribute goes:

<Menu.List.Item renderAs="span" href="/x">Home</Menu.List.Item>
<Menu.Item as="span">Home</Menu.Item>

Most targets take no href at all. It lives on Menu.Item, Navbar.Item, Navbar.Link, Panel.Block, Dropdown.Item and the three Pagination controls, which render an <a> unless told otherwise, and on Button and Level.Item once as="a" names one — those two render a <button> and a <div> by default, and drop the attribute. Everywhere else the codemod removes it.

Dropdown.Item is the one to read twice: it accepts as="a" | "div" | "button" and takes the props of whichever you name, so the default <a> keeps an href and the other two do not. Drop the as to make it a link again; inside the <button> form an <a> would nest interactive content, so navigate in onClick there.

prop:target, prop:download, prop:hrefLang, prop:ping, prop:referrerPolicy, prop:media

target, download, hrefLang, ping, referrerPolicy and media follow the element the same way href does, and they are invalid on the wrong one whether or not an href is beside them — <Navbar.Link as="span" target="_blank"> does not compile on its own. Each is judged against the element that actually renders, not as a group, so a referrerPolicy on an <img> or a target on a <form> stays where it is legal. Where one is removed the TODO quotes it. Put it on an <a> inside, or make the element one that takes it.

rel is never touched: React declares it on HTMLAttributes, so it is valid on every element.

A component can be narrower than its element. One that takes no href at any as takes none of these either. Level.Item is not narrower: it declares the anchor's whole attribute surface at every as and forwards it only on the <a>, so all of these survive at as="a" and none of them reaches a <p> or a <div>.

prop:type — a <button> item that no longer submits its form

Navbar.Item, Navbar.Link, Menu.Item and Dropdown.Item write type="button" on the <button> an as makes them render, whenever the element sets no type or one HTML doesn't define. A plain <button> with neither submits the form around it, so an item you rendered as a button with renderAs="button" stops submitting once migrated. The codemod can't tell whether one sits in a form, so each gets a TODO:

<Navbar.Item renderAs="button">Search</Navbar.Item>
<Navbar.Item as="button">Search</Navbar.Item>

Add type="submit" if it should still submit, or type="button" to say it shouldn't, then delete the comment. An item whose type is written out as button, submit or reset, or comes from a spread or an expression, gets no TODO.

Helper props dropped from plain-element replacements

Where the codemod produced a plain element (Form.Label → <label>, Breadcrumb.Item → <li>, Table.Container fallback <div>), Bulma helper props were dropped with a TODO. Re-express them as classes: m={2} → className="m-2", textAlign="center" → className="has-text-centered".

prop:display-base — a base display beside a per-viewport one

bestax leaves a base display out once any per-viewport display prop (displayMobile and the rest) is set, so the codemod keeps the base value as the class it stood for, in className, where the display attribute was (is-flex, is-hidden for none). With a flex base and no per-viewport flex display, the flex container props (justifyContent, alignItems and the rest) render only beside a flex display prop, so they move into className too (is-justify-content-center), and a container value bestax doesn't take stays where it was. This TODO, whose message starts "bestax leaves display out beside a per-viewport display prop", is the case where nothing moves, because a per-viewport display, the base value, the className or a container prop is dynamic, or the element takes a spread, which could hold any of them:

<Box className={cls} display="flex" displayMobile="block" />
<Box className={`is-flex ${cls}`} displayMobile="block" />

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts18d3 checks · Risk SAFE
  • Gen Agent Trust Hub18d

    The skill provides comprehensive instructions and reference material for migrating React applications or static HTML pages to the @allxsmith/bestax-bulma library using the bestax-migrate codemod. No malicious patterns or security risks were identified.

  • Socket18d

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 9cf369a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 days ago

README badge

README badge for allxsmith/bestax/bestax-migrate