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.

referencesbulma-classesprop-map.md

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

Bulma classes → bestax-bulma prop map

Which class becomes which prop, per component, then the helper classes most components take. A class that becomes no prop stays in className. So does a second class for a prop already written (is-small is-large keeps is-large), so the element still renders both. A second color gets a modifier:<root> TODO (modifier:button), since only one of the two may show.

{viewport} is one of mobile, tablet, desktop, widescreen, fullhd unless a row says otherwise, and the prop takes the matching suffix: is-6-tablet → sizeTablet="6".

Component classes

.button → Button

Classes Prop
is-primary, is-link, is-info, is-success, is-warning, is-danger, is-white, is-dark, is-black, is-text, is-ghost color
is-small, is-normal, is-medium, is-large size
is-light isLight
is-rounded, is-loading, is-static, is-outlined, is-inverted isRounded, isLoading, isStatic, isOutlined, isInverted
is-focused, is-active, is-hovered isFocused, isActive, isHovered
is-fullwidth isFullwidth

is-disabled stays a class: isDisabled also writes disabled or aria-disabled, which the element did not have. On any tag but <button>, bestax takes the element's as (<a className="button"> → <Button as="a">).

is-loading becomes isLoading, so a converted loading button gains what bestax's loading Button does: it writes aria-busy="true" and aria-disabled="true", and drops a click while it loads, from the keyboard too, where Bulma's spinner stops only the pointer. Its onClick doesn't run then, and neither does the form submit, the reset or the link it would have triggered. A .button that sets its own aria-busy or aria-disabled keeps is-loading as a class instead, since isLoading would write both over it, so it renders as written.

.buttons → Buttons, .tags → Tags

Classes Prop
is-centered, is-right (Buttons) isCentered, isRight
has-addons hasAddons
are-small, are-medium, are-large size (Tags: medium and large)

.columns → Columns

Classes Prop
is-centered, is-gapless, is-multiline, is-mobile, is-desktop isCentered, isGapless, isMultiline, isMobile, isDesktop
is-vcentered isVCentered
is-0 … is-8 gap
is-0-{viewport} … is-8-{viewport} gap{Viewport}

.column → Column

Sizes are 1 to 12, full, half, one-third, two-thirds, one-quarter, three-quarters, one-fifth, two-fifths, three-fifths and four-fifths.

Classes Prop
is-{size} size
is-{size}-{viewport} size{Viewport}
is-offset-{size} (no full) offset
is-offset-{size}-{viewport} offset{Viewport}
is-narrow isNarrow
is-narrow-{viewport}, is-narrow-touch isNarrow{Viewport}, isNarrowTouch

.container → Container

Classes Prop
is-fluid, is-widescreen, is-fullhd fluid, widescreen, fullhd
is-max-tablet, is-max-desktop, is-max-widescreen breakpoint and isMax

.title → Title, .subtitle → SubTitle

Classes Prop
is-1 … is-6 size, only on the matching <hN> or a <p>
is-spaced (Title) isSpaced
has-skeleton hasSkeleton

bestax picks the heading from size (size="3" renders an <h3>) unless as="p". So on an <h2>, is-4 stays a class and the element becomes <Title as="h2" className="is-4">, which renders the same <h2>. To write it as a prop, textSize="4" keeps the <h2> and sizes it the same: it renders Bulma's is-size-4, which has the font size is-4 gives a title or subtitle, and as a Bulma helper it is !important, so check a title the page's own CSS sizes. The codemod's modifier:title (or modifier:subtitle) TODO on the element says the same.

Other components

Component Classes Prop
.breadcrumb → Breadcrumb is-centered, is-right alignment
.breadcrumb → Breadcrumb has-arrow-separator, has-bullet-separator, has-dot-separator, has-succeeds-separator separator
.breadcrumb → Breadcrumb is-small, is-medium, is-large size
.card-header-title → Card.Header.Title is-centered centered
.content → Content is-small, is-medium, is-large size
.delete → Delete is-small, is-medium, is-large size
.field → Field is-horizontal, is-grouped, has-addons, is-narrow horizontal, grouped, hasAddons, narrow
.field → Field has-addons-centered, has-addons-right, beside has-addons hasAddons="centered", hasAddons="right", which render both classes
.field → Field is-grouped-centered, is-grouped-right, is-grouped-multiline, beside is-grouped grouped="centered", grouped="right", grouped="multiline", which render both classes
.grid → Grid is-gap-{step}, is-column-gap-{step}, is-row-gap-{step}, 0 to 8 in half steps (is-gap-1.5) gap, columnGap, rowGap
.grid → Grid is-col-min-{1-32} minCol (a number: minCol={8})
.fixed-grid → Grid isFixed (folded) has-{1-12}-cols, has-{1-12}-cols-{viewport}, has-auto-count fixedCols, fixedCols{Viewport} (numbers: fixedCols={3}), fixedCols="auto"
.cell → Cell is-col-start-{n}, is-col-from-end-{n}, is-col-span-{n}, is-row-start-{n}, is-row-from-end-{n}, is-row-span-{n}, for n from 1 to 12 colStart, colFromEnd, colSpan, rowStart, rowFromEnd, rowSpan (numbers: colSpan={2})
.field-label → Field.Label is-small, is-normal, is-medium, is-large size
.control → Control has-icons-left, has-icons-right, is-loading, is-expanded hasIconsLeft, hasIconsRight, isLoading, isExpanded
.control → Control, .input → InputBase, .textarea → TextAreaBase is-small, is-medium, is-large size
.input → InputBase, .textarea → TextAreaBase is-rounded, is-static, is-hovered, is-focused isRounded, isStatic, isHovered, isFocused
.input → InputBase is-loading isLoading
.textarea → TextAreaBase is-active, has-fixed-size isActive, hasFixedSize
.select → SelectBase is-small, is-medium, is-large size
.select → SelectBase is-rounded, is-loading, is-active, is-fullwidth isRounded, isLoading, isActive, isFullwidth
.select → SelectBase is-multiple, around a <select multiple> multiple (the <select>'s size becomes the number multipleSize)
.file → File is-small, is-medium, is-large size
.file → File is-boxed, is-fullwidth, has-name, is-right isBoxed, isFullwidth, hasName, isRight
the <select> inside .select is-hovered, is-focused isHovered, isFocused
.hero → Hero is-primary, is-link, is-info, is-success, is-warning, is-danger, is-black, is-white, is-light, is-dark color
.hero → Hero is-small, is-medium, is-large, is-fullheight, is-fullheight-with-navbar size
.image → Image is-16x16, is-24x24, is-32x32, is-48x48, is-64x64, is-96x96, is-128x128, is-square size
.image → Image is-{ratio}, for each of the Ratios under Helper classes (is-16by9), but not is-square (see below) size, on the <figure> it renders with no as (see below)
the <img> inside .image is-rounded isRounded
.icon → Icon is-small, is-medium, is-large size
.tabs → Tabs is-centered, is-right, is-left align
.tabs → Tabs is-small, is-medium, is-large size
.tabs → Tabs is-fullwidth, is-boxed, is-toggle, is-toggle-rounded isFullwidth, boxed, toggle, rounded (is-<color> stays a class: color is deprecated)
the <a> in a menu item → Menu.Item is-active, beside an aria-current of the <a>'s own active (without one, the item stays markup with an attr:aria-current TODO)
.pagination → Pagination is-small, is-medium, is-large size
.pagination → Pagination is-centered, is-right, is-rounded align, rounded (is-<color> stays a class: color is deprecated)
.pagination-link → Pagination.Link is-current, beside an aria-current of the element's own active (without one, it stays a class; is-disabled stays a class)
.level → Level is-mobile isMobile
.navbar → Navbar the ten .hero colors color
.navbar → Navbar is-fixed-top, is-fixed-bottom fixed (top, bottom)
.navbar → Navbar is-transparent, is-spaced, has-shadow transparent, isSpaced, hasShadow
.navbar-menu → Navbar.Menu is-active active (the menu is open)
.navbar-item → Navbar.Item is-active, beside an aria-current of the element's own active (without one, it stays a class)
.navbar-dropdown → Navbar.DropdownMenu is-right, is-up right, up
.notification → Notification is-primary, is-link, is-info, is-success, is-warning, is-danger, is-black, is-white, is-dark color
.notification → Notification is-light isLight
.panel-block → Panel.Block is-active, beside an aria-current of the element's own active (without one, it stays a class)
.progress → Progress the ten .hero colors color
.progress → Progress is-small, is-medium, is-large size
.section → Section is-medium, is-large size
.skeleton-lines → Skeleton variant="lines" its bare, empty <div>s lines (their count, as a number: lines={5})
.table → Table is-bordered, is-striped, is-narrow, is-hoverable, is-fullwidth isBordered, isStriped, isNarrow, isHoverable, isFullwidth
.tag → Tag is-primary, is-link, is-info, is-success, is-warning, is-danger, is-black, is-dark, is-white color
.tag → Tag is-light, is-rounded, is-hoverable isLight, isRounded, isHoverable
.tag → Tag is-medium, is-large size

is-square sits with the fixed sizes, not the ratios. Bulma sizes it like is-1by1, but Image renders size="square" on a <div>, as it does a fixed size. So <figure className="image is-square"> becomes <Image as="figure" size="square">, while <figure className="image is-1by1"> becomes <Image size="1by1">.

A ratio converts to identical markup only on a bestax-bulma whose Image writes nothing but the ratio class on its container. An older one also writes has-ratio there, which Bulma reads only on a child, so the page looks the same, unless that .image sits inside another ratio .image, which then stretches it to fill. Upgrade bestax-bulma, or keep that ratio as a class.

Progress takes value and max as numbers: value="40" becomes value={40}. An expression (value={percent}) carries over as written, so if it holds a string the migrated file fails to typecheck while still rendering the same; wrap it in Number(…). Delete converts only with type and aria-label set (see defaults:<Target> in the unmappables), and a type="button" is dropped, since bestax renders it by itself. Card.Header.Icon likewise converts only with an aria-label and a type of button, submit or reset, since it renders aria-label="more options" and type="button" otherwise. .tag's is-delete stays a class: isDelete turns the tag into a <button>. A .navbar-item's has-dropdown and is-hoverable stay classes too, since bestax has no prop for them on that component. So do a .field's has-addons-centered, has-addons-right and is-grouped-* without has-addons or is-grouped beside them, because the hasAddons and grouped values that render them render those as well, and an input's, textarea's or select's color, because color renders has-text-<color> on it too. On a .columns, the gap helpers (is-gap-*, is-column-gap-*, is-row-gap-*) stay classes as well: Columns' own gap is its gutter (is-<step>), and it leaves the column and row gap helpers out.

Helper classes

These convert on the components above that take helper props, and on the plain-tag wrappers.

Colors are primary, link, info, success, warning, danger, black, black-bis, black-ter, grey-darker, grey-dark, grey, grey-light, grey-lighter, white, white-bis, white-ter, light, dark, inherit and current. Shades are 00 to 95 in steps of five, invert, light, dark, soft, bold and on-scheme, on the colors Bulma shades: primary, link, info, success, warning, danger, black, white, light and dark. Gap steps are 0 to 8 in half steps (0, 0.5, 1, … 7.5, 8). Overflow values are auto, clip, hidden, scroll and visible. Ratios are 1by1, 5by4, 4by3, 3by2, 5by3, 16by9, 2by1, 3by1, 4by5, 3by4, 2by3, 3by5, 9by16, 1by2 and 1by3.

Classes Prop
m-{n}, mt-{n}, mr-{n}, mb-{n}, ml-{n}, mx-{n}, my-{n} (0 to 6, auto) m, mt, mr, mb, ml, mx, my
p-{n}, pt-{n}, pr-{n}, pb-{n}, pl-{n}, px-{n}, py-{n} p, pt, pr, pb, pl, px, py
is-marginless, is-paddingless (Bulma 0.9's, which v1 removed) m="0", p="0", which render v1's m-0 and p-0
has-text-{color} textColor (on Menu, Menu.Label, Menu.List and Table, color)
has-background-{color} bgColor (on Menu, Menu.Label, Menu.List, Tag, File, InputBase, TextAreaBase and SelectBase, backgroundColor)
has-text-{color}-{shade}, has-background-{color}-{shade} the same color prop, with colorShade or backgroundColorShade (textColor="primary" colorShade="on-scheme")
is-size-1 … is-size-7, and -{viewport} textSize, textSize{Viewport}
has-text-centered, -justified, -left, -right, and -{viewport} textAlign, textAlign{Viewport}
is-capitalized, is-lowercase, is-uppercase, is-italic, is-underlined textTransform
has-text-weight-light, -normal, -medium, -semibold, -bold textWeight
is-family-sans-serif, -monospace, -primary, -secondary, -code fontFamily
is-block, is-flex, is-inline, is-inline-block, is-inline-flex, is-grid display
the same with any of the nine viewports, touch and the -only ones included display{Viewport}
is-hidden, is-invisible, is-sr-only visibility
is-hidden-{viewport}, is-invisible-{viewport}, all nine viewports visibility{Viewport}
is-flex-direction-*, is-flex-wrap-*, is-justify-content-*, is-align-content-*, is-align-items-* flexDirection, flexWrap, justifyContent, alignContent, alignItems
is-align-self-*, is-flex-grow-*, is-flex-shrink-* alignSelf, flexGrow, flexShrink
is-pulled-left, is-pulled-right float
is-gap-{step}, is-column-gap-{step}, is-row-gap-{step} gap, columnGap, rowGap
is-gapless gapless
is-position-absolute, -fixed, -relative, -static, -sticky pos
is-relative relative
is-clipped overflow="clipped"
is-overflow-{value}, is-overflow-x-{value}, is-overflow-y-{value} overflow, overflowX, overflowY
is-overlay, is-skeleton, is-clearfix overlay, skeleton, clearfix
is-unselectable, is-clickable interaction
is-radiusless, has-radius-small, -normal, -large, -rounded radius
is-shadowless shadow
is-aspect-ratio-{ratio} aspectRatio
is-mobile, is-narrow (where the component has no prop of its own for them) responsive

Where a component renders a color class through no typed prop, the class stays: has-text-* on Breadcrumb, Hero, Navbar.DropdownMenu, Navbar.Divider, Field.Label, Field.Body, Control, File, InputBase, TextAreaBase, SelectBase, Progress, Skeleton, Tag, Tags, Modal.Background, Modal.Content, Modal.Card, Modal.Card.Head, Modal.Card.Title, Modal.Card.Body, Modal.Card.Foot, Pagination.Previous, Pagination.Next, Pagination.Ellipsis, Panel, Panel.Heading, Panel.Tabs, Panel.Block and Tabs; has-background-* on Breadcrumb, Navbar.Brand, Navbar.Menu, Navbar.Start, Navbar.End, Navbar.DropdownMenu, Navbar.Divider, Field.Label, Field.Body, Control, Notification, Progress, Skeleton, Table, Tags, Modal.Background, Modal.Content, Modal.Card, Modal.Card.Head, Modal.Card.Title, Modal.Card.Body, Modal.Card.Foot, Pagination.Previous, Pagination.Next, Pagination.Ellipsis, Panel, Panel.Heading, Panel.Tabs, Panel.Block and Tabs. Navbar.DropdownMenu, Navbar.Divider, Field.Label, Field.Body, Control, Skeleton, Modal's parts, Pagination.Previous, Pagination.Next, Pagination.Ellipsis, Panel.Heading, Panel.Tabs and Panel.Block take no helper props the way the codemod needs, so every helper class on them stays. A .panel's is-<color> stays a class too, since Panel's color renders has-text-<color> beside it.

Some classes stay put because of how bestax renders them:

  • A base display class next to a per-viewport one (is-flex is-block-mobile) keeps the base class: bestax drops the base display whenever a per-viewport one is set.
  • The flex-container classes (is-justify-content-* and the others in that row) convert only beside a flex display prop, the only place bestax renders them.
  • is-gapless beside an is-gap-* keeps its class: bestax drops gapless when a gap is set. On a .grid both convert, since Grid's own gap renders its class beside gapless.
  • is-relative beside an is-position-* keeps its class: pos decides the position, and bestax drops relative beside it. is-overlay converts beside either.
  • A both-axes overflow (is-overflow-hidden, is-clipped) beside an is-overflow-x-* or is-overflow-y-* keeps its class: beside an axis prop, bestax writes overflow per axis instead of as its own class.
  • is-hidden becomes visibility="hidden", which renders the same class and doesn't interact with display.
  • is-marginless and is-paddingless are the only classes a conversion changes: they style nothing under v1, so they become the prop of the v1 helper that does their job. A live class for the same prop keeps it, whichever is written first, so beside p-2 the class stays with a legacy: TODO, and so it does wherever the element stays markup. Beside a class for another prop, such as px-2, it still converts: v1 puts every side and axis class after p-0, so px-2 keeps its sides.

Classes that stay classes

A color shade one color and one shade can't write (has-text-primary-100, the -invert of a shade such as has-text-primary-30-invert, a shade of the text color), a shade or color for a prop another class already wrote (has-text-primary-30 has-text-info-40 keeps the second), the palettes and is-bold and is-soft, the -touch and -only breakpoints of text size and alignment, Grid and .image modifiers away from their own element, v1's marginless and paddingless (the rules of m-0 and p-0 under other names), and the Bulma helpers bestax has no prop for (is-display-*, is-visibility-*, is-float-*, is-clear-*, …) stay in className. They render exactly as before. An .image size or ratio away from its .image also gets a modifier:image TODO, since Bulma styles it only there.

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