Recipes for every TODO(bestax-migrate) the rbx codemod leaves
Ordered by how often they appear when the codemod runs over rbx's own documentation examples. Resolve the comment, then delete it. Never silence a TODO without converting the code.
component:Icon — the icon child
bestax's Icon takes a required name instead of an icon child, and rbx's docs teach the
FontAwesome component form, which carries no readable name.
<Icon size="small"><FontAwesomeIcon icon={faHome} /></Icon>
<Icon name="home" library="fa" variant="solid" size="small" />library is fa | mdi | ion | material-icons | material-symbols; variant is the style
(solid, regular, brands, …). Icon-font children the parser can read
(<i className="fas fa-home" />) are converted automatically, with modifier classes such as
fa-spin carried as bestax's features; a child that also carries an app class of its own is
kept and flagged instead.
component:Tile — Bulma v1 removed tiles
Use Grid and Cell. Tile kind="ancestor" becomes <Grid>, kind="parent"/kind="child"
become <Cell>, and size={n} becomes a column span.
<Tile kind="ancestor"><Tile kind="parent" size={4}><Tile kind="child">x</Tile></Tile></Tile>
<Grid><Cell colSpan={4}>x</Cell></Grid>component:Heading — Bulma v1 dropped .heading
rbx's Heading is Bulma 0.9's small uppercase label, and bestax has no component for it. It becomes
the plain element rbx rendered, a <p> or the tag a literal as names, with className="heading",
but Bulma v1 has no rule for that class, so the label renders as body text. Restyle it with helper props, as a small, uppercase, semibold
Paragraph:
<Heading>Followers</Heading>
<Paragraph textSize="7" textTransform="uppercase" textWeight="semibold" mb="1">
Followers
</Paragraph>Or keep the class and give it 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;
}component:File.* — the file-input parts
bestax's <File> renders the whole Bulma structure itself, so File.Label, File.Input,
File.CTA, File.Icon and File.Name have nothing to become.
<File hasName>
<File.Label>
<File.Input name="upload" />
<File.CTA><File.Label>Choose…</File.Label></File.CTA>
<File.Name>none</File.Name>
</File.Label>
</File>
<File name="upload" label="Choose…" hasName />prop:as — polymorphism
rbx puts as on everything; bestax does not. Either render the tag directly, or restructure.
See the as section of prop-map.md for the components that do accept it.
The same rule fires a second way: several bestax components accept as but narrow it to the
tags Bulma's markup allows there, so a literal outside that union (<Control as="span">,
<Media as="section">) is dropped and named. The TODO lists the tags that component renders.
A dynamic as on a component that becomes plain markup is flagged too: the plain element is the
one rbx rendered by default.
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. rbx let the two disagree, and the browser ignored the result:
<Menu.List.Item as="span" href="/x"> rendered a <span> that navigated nowhere.
The codemod keeps the element you asked for and drops the attribute that did nothing:
<Menu.List.Item as="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 as="button" stops submitting once migrated. The codemod can't tell whether one sits
in a form, so each gets a TODO:
<Navbar.Item as="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.
component:Generic — rbx's base element
Generic is rbx's untyped passthrough. Render the underlying tag, and move its helper props to
the nearest bestax component (or a className).
component:Dropdown and its parts
bestax's Dropdown takes a label and renders its own trigger and menu, so rbx's four-element
structure collapses to one.
<Dropdown>
<Dropdown.Trigger>Open</Dropdown.Trigger>
<Dropdown.Menu><Dropdown.Content>
<Dropdown.Item active>one</Dropdown.Item>
</Dropdown.Content></Dropdown.Menu>
</Dropdown>
<Dropdown label="Open">
<Dropdown.Item active>one</Dropdown.Item>
</Dropdown>Navbar.Item dropdown — open/close state is not carried over
The structural rewrite is automatic (<Navbar.Item dropdown> becomes
<Navbar.Dropdown>, and rbx's <Navbar.Dropdown> becomes <Navbar.DropdownMenu>), but the
behaviour is not the same. rbx's dropdown owns its own click and outside-click state; bestax's
Navbar.Dropdown is presentational and opens from hoverable or a controlled active.
So a migrated dropdown renders correctly and does nothing on click. Pick one:
<Navbar.Dropdown hoverable>…</Navbar.Dropdown> // opens on hover
<Navbar.Dropdown active={open}>…</Navbar.Dropdown> // you own the stateNothing flags this — the markup is valid either way — so audit your navbars after migrating.
component:List — the bulma-list extension
Bulma v1 does not ship it. Use <UnorderedList>/<UnorderedList.Item> for a plain list, or
<Menu>/<Menu.Item> when the items are navigation.
component:Fieldset — an input placed straight in it
bestax's Fieldset starts its own Field scope, and rbx's bare <fieldset> never did. So an input
placed straight in it, such as an Input, renders as it does outside any Field, with a .field
of its own where it has one. Where the Fieldset sits inside a Field or a Control in the same
component, the codemod keeps the plain <fieldset> rbx rendered. It can't see one in another
component, so it converts the Fieldset and leaves this TODO where an input sits straight in it.
If nothing renders the Fieldset inside a Field or a Control, delete the comment. If something
does, render a plain <fieldset> instead, which leaves their scope alone:
<Fieldset disabled variant="unstyled">
<Input />
</Fieldset>
<fieldset disabled>
<Input />
</fieldset>component:Numeric, component:Highlight
No bestax equivalents, and none needed: use Intl.NumberFormat directly, and use <Pre> with your
own highlighter.
responsive — touch and { only: true }
bestax's viewports are mobile/tablet/desktop/widescreen/fullhd, with no touch and no
-only variants. Reach for a className with the Bulma class, or restyle in CSS.
The codemod always removes the whole responsive prop, even when part of it could not be
converted — bestax has its own unrelated responsive prop ('mobile' | 'narrow'), so leaving a
half-emptied rbx object behind would be a type error rather than a leftover. The TODO names
which breakpoints did not carry.
A size bestax doesn't take (prop:size)
Button.Group, Tag.Group and Message sizes carry over as written when bestax's Buttons,
Tags 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.
A dynamic Image.Container size gets the same rule, since the codemod can't turn it into
bestax's NxN form. Set size on the migrated <Image> by hand.
prop:size on Title: a size the codemod cannot carry
rbx's Title 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 "Title sizes" in the prop map). A dynamic one cannot move, because
textSize takes a string, so it stays size. Pass it to textSize yourself:
<Title size={compact ? 5 : 4}>Report</Title>
<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 Title that sets size and textSize both: drop size and let
textSize set the font size.
Props with no counterpart
| TODO | What to do |
|---|---|
prop:closeOnBlur on Modal |
the migrated compound form renders Modal.Background as you wrote it; wire its onClick to your onClose |
prop:selected, prop:text on Button |
className="is-selected"; for is-text use color="ghost" or a link |
prop:gradient on Hero |
Bulma v1 removed is-bold gradients; use bgColor or a custom class |
prop:color, prop:vertical on Divider |
bestax's Divider takes only bgColor and renders an <hr> |
component:Divider (a labelled divider) |
rbx rendered <Divider>OR</Divider>'s children as a centred label via data-content; bestax's Divider is a bare <hr> and takes no children -- React rejects children on a void element at runtime. Put the label in surrounding markup, or drop it |
prop:direction on PageLoader |
no directional variant; drop it or add a class |
prop:managed |
bestax components are uncontrolled; drive the Modal with active and onClose |
prop:document on Modal |
bestax portals via portal, but it takes true, a selector or an element rather than a Document — see Modal: what carries over |
prop:document on Navbar |
bestax's Navbar has no document prop; drop it |
prop:backgroundColor |
Notification, Table and its parts, Tabs, Checkbox, Radio, Progress and the other components that take neither bgColor nor backgroundColor keep it as written; move the color to a has-background-* class in className |
prop:textColor |
On Tag, Tabs, Hero, Progress, Breadcrumb, Input, Select, TextArea, File and the other components with no textColor, it stays as written: move the color to a has-text-* class in className. On Table (and its Thead, Tbody and Tfoot), Menu and its parts, and Dropdown and its Item it becomes color for one of bestax's color names, and stays flagged where the element 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 |
badgeOutlined, badgeRounded, badgeSize |
bestax's Badge has no outline, pill or size variant |
tooltipResponsive |
bestax's Tooltip has one position for all viewports |
Modal: what carries over
component:Modal — emitted on every Modal the codemod converts, whether or not you passed
any of the props above.
rbx's Modal did three things by default. bestax now does two of them the same way, and the third is one prop away:
| rbx default | bestax |
|---|---|
| closes on Escape | same, closeOnEscape defaults to true |
| clips document scroll while open | same, lockScroll defaults to true |
portals into document.body |
renders inline unless you set portal (true, selector, element) |
So the only one that needs an edit is the portal, and it matters most when an ancestor has
overflow: hidden, filter or a transform — any of which will clip or re-parent a modal that
used to escape them. portal renders inline on the server and during hydration, then moves once
the client takes over, so it is safe under SSR.
The codemod maps closeOnEsc to closeOnEscape for you, so closeOnEsc={false} keeps
suppressing Escape rather than silently inheriting the new default.
Background click depends on which form you land in. bestax's Modal has a legacy form — bare
children — where it renders its own background and close button, both wired to onClose, so
closeOnBlur carries over for free. A Modal.Content or Modal.Card child selects the compound
form instead, which renders only what you wrote; there, wire your own Modal.Background's
onClick to the same onClose.
The open modal is a dialog, so give it a name, with aria-label, or aria-labelledby pointing at
its title (name:Modal).
name:Modal: a modal with no name
A converted Modal (or Modal.Container) 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={open} 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>value-reference — a component used as a value
const X = Card.Header; and similar. The codemod rewrites what it can prove safe and flags the
rest; convert the usage by hand.
Dynamic values
Anything the codemod cannot read statically (state={x}, align={side},
subtitle={isSub}) is left in place with a TODO. Split the branch by hand — the codemod never
guesses at a runtime value.