Migrating Tailwind classes
Any element or component that uses Tailwind classes.
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").
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:
| Tailwind class | Pluma 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:
Target:
Source:
Target:
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:
Target:
Source:
Target:
| Tailwind class | Pluma 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" |
| Tailwind class | Pluma 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" |
| Tailwind class | Pluma argument |
|---|---|
class="relative" | @position="relative" |
class="absolute" | @position="absolute" |
class="fixed" | @position="fixed" |
class="sticky" | @position="sticky" |
Flex layouts using Tailwind’s classes of flex(display: flex),
and flex-specific configuration styles can be replaced either by:
PlumaModalHeader, PlumaModalFooter etc within a PlumaModal (rather than using custom flex boxes)PlumaBox for all available arguments), for example:| Tailwind class | Pluma 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 layouts should, where possible, use the PlumaGrid component.
Source:
Target:
Any Tailwind classes used for font styles, sizes, weights, colors etc. should be replaced by:
PlumaCodePlumaHeadingPlumaEmphasisPlumaParagraphPlumaStrongPlumaTextLabel
@label arguments,
PlumaTextLabel can be used in other situations where we need to achieve a “label”-like text stylePlumaText is a more
generic component for setting text styles via props like @weight, @text
PlumaText, and as such
also support the same props for overriding a specific font styleOther typography-related classes might be replaced by sprinkles, e.g.:
| Tailwind class | Pluma 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" |
| Tailwind class | Pluma 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" |