Tailwind

Migrating Tailwind classes


Source component

Any element or component that uses Tailwind classes.

Target component

Where possible, use the specific Pluma component that matches the Tailwind class. When no specific Pluma component is available, use the generic PlumaBox component.

Additionally, all Pluma components support utility args (we call them "sprinkles").

Mapping

Spacing

In Tailwind, the margin and padding classes are named m-<value>, p-<value>, mt-<value>, etc.

When <value> is a specific number (e.g. m-1, p-2), it refers to the space token system, where the number is a multiple of 8px.

In Pluma, the value token system is similar in that they're multiples of 8px, but the scale of the numbers is based on 100. A Tailwind 1 is a Pluma 100, a Tailwind 1.5 is a Pluma 150, etc.

Tailwind margin and padding classes have variants for each side, and shorthands. Pluma supports the same variants and shorthands as sprinkle arguments:

table
Tailwind classPluma argument
m-<value>@m="<value>"
mt-<value>@mt="<value>"
mr-<value>@mr="<value>"
mb-<value>@mb="<value>"
ml-<value>@ml="<value>"
mx-<value>@mx="<value>"
my-<value>@my="<value>"
p-<value>@p="<value>"
pt-<value>@pt="<value>"
pr-<value>@pr="<value>"
pb-<value>@pb="<value>"
pl-<value>@pl="<value>"
px-<value>@px="<value>"
py-<value>@py="<value>"

Source:

<div class="mt-1"></div>

Target:

<PlumaBox @mt="100" />

Source:

<div class="py-2"></div>

Target:

<PlumaBox @py="200" />

For the space-x-<value> or space-y-<value> classes, they can be replaced with the @gap argument when paired with the right component (a flex or grid component).

Source:

<div class="space-y-1.5"></div>

Target:

<PlumaStack @gap="150" />

Source:

<div class="space-x-3"></div>

Target:

<PlumaInlineStack @gap="300" />

Display

table
Tailwind classPluma argument
class="hidden"@display="none"
class="block"@display="block"
class="inline-block"@display="inline-block"
class="inline"@display="inline"
class="flex"@display="flex"
class="inline-flex"@display="inline-flex"
class="grid"@display="grid"
class="inline-grid"@display="inline-grid"

Overflow

table
Tailwind classPluma argument
class="overflow-hidden"@overflow="hidden"
class="overflow-scroll"@overflow="scroll"
class="overflow-visible"@overflow="visible"
class="overflow-auto"@overflow="auto"
class="overflow-clip"@overflow="clip"
class="overflow-x-hidden"@overflowX="hidden"
class="overflow-x-scroll"@overflowX="scroll"
class="overflow-x-visible"@overflowX="visible"
class="overflow-x-auto"@overflowX="auto"
class="overflow-x-clip"@overflowX="clip"
class="overflow-y-hidden"@overflowY="hidden"
class="overflow-y-scroll"@overflowY="scroll"
class="overflow-y-visible"@overflowY="visible"
class="overflow-y-auto"@overflowY="auto"
class="overflow-y-clip"@overflowY="clip"

Position

table
Tailwind classPluma argument
class="relative"@position="relative"
class="absolute"@position="absolute"
class="fixed"@position="fixed"
class="sticky"@position="sticky"

Flexbox

Flex layouts using Tailwind’s classes of flex(display: flex), and flex-specific configuration styles can be replaced either by:

  • purpose-built components, where possible, for example:
    • using the modal’s PlumaModalHeader, PlumaModalFooter etc within a PlumaModal (rather than using custom flex boxes)
  • layout helper components, depending on the use case:
  • utility sprinkle arguments on Pluma components (see PlumaBox for all available arguments), for example:
table
Tailwind classPluma argument
class="flex"@display="flex"
class="flex-row"@flexDirection="row"
class="flex-col"@flexDirection="column"
class="justify-start"@justifyContent="flex-start"
class="items-center"@alignItems="center"
class="flex-wrap"@flexWrap="wrap"
class="shrink"@flexShrink="1"
class="shrink-0"@flexShrink="0"
class="grow"@flexGrow="1"
class="grow-0"@flexGrow="0"
class="flex-1"@flex="1"
class="flex-auto"@flex="auto"
class="flex-initial"@flex="initial"
class="flex-none"@flex="none"

Grid

Grid layouts should, where possible, use the PlumaGrid component.

Source:

<div class="grid grid-cols-3 gap-2"></div>

Target:

<PlumaGrid @columns={{3}} @gap="200" />

Typography

Any Tailwind classes used for font styles, sizes, weights, colors etc. should be replaced by:

  • a typography component:
  • if the above components don’t fit, PlumaText is a more generic component for setting text styles via props like @weight, @text
    • the above typography components all extend from PlumaText, and as such also support the same props for overriding a specific font style

Other typography-related classes might be replaced by sprinkles, e.g.:

table
Tailwind classPluma argument
class="text-left"@textAlign="left"
class="text-center"@textAlign="center"
class="text-right"@textAlign="right"
class="no-underline"@textDecoration="none"
class="underline"@textDecoration="underline"
class="uppercase"@textTransform="uppercase"
class="lowercase"@textTransform="lowercase"
class="capitalize"@textTransform="capitalize"
class="text-ellipsis"@textOverflow="ellipsis"
class="truncate"@truncate={{true}}
class="whitespace-nowrap"@whiteSpace="nowrap"

Cursor/interaction

table
Tailwind classPluma argument
class="select-none"@userSelect="none"
class="cursor-pointer"@cursor="pointer"
class="cursor-default"@cursor="default"
class="cursor-not-allowed"@cursor="not-allowed"
class="cursor-help"@cursor="help"
class="cursor-wait"@cursor="wait"