@nico2433/rbxts-react-utils
v1.2.4
Published
This is a utility package for [@rbxts/react-roblox](https://www.npmjs.com/package/@rbxts/react-roblox), providing custom components with compatibility for [TailwindCSS](https://tailwindcss.com) classes to Roblox UI components and other utilities.
Readme
@nico2433/rbxts-react-utils
This is a utility package for @rbxts/react-roblox, providing custom components with compatibility for TailwindCSS classes to Roblox UI components and other utilities.
Installation
Install the package with an alias under the rbxts package:
npm i @rbxts/react-utils@npm:@nico2433/rbxts-react-utilsFeatures
This package adds custom components that have compatibility with TailwindCSS classes for Roblox UI components. All classes based on pixels will have their passed value multiplied by 4. For example, p-4 will be 16px, just like in Tailwind. Classes should accept custom parameters with or without brackets.
Currently Support
FrameImageButtonImageLabelScrollingFrameTextBoxTextButtonTextLabelVideoFrameViewPortFrame
Supported Pseudo Classes
hover: hover eventNote: Pseudo classes don't work with all properties that need an extra instance, like flex | padding | corner radius | size constraint
Supported Classes
AnchorPoint (percentage-based)
a: sets both x and y anchor pointsax: sets x anchor pointay: sets y anchor point
BorderRadius
rounded-smroundedrounded-mdrounded-lgrounded-xlrounded-2xlrounded-3xl- Note: Selective corner rounding does not work.
BorderWidth
border
Color
- Supports all Tailwind base colors.
bg: backgroundtext: textborder: border
Opacity (percentage-based)
opacitybg-opacitytext-opacityimage-opacity
Padding
p: paddingpx: padding-left and padding-rightpy: padding-top and padding-bottompt: padding-toppr: padding-rightpb: padding-bottompl: padding-left
Position
inset: sets all four inset valuesinset-x: sets left and right inset valuesinset-y: sets top and bottom inset valuestop: top inset valueright: right inset valuebottom: bottom inset valueleft: left inset value
Size
size: sets both width and heightw: widthh: height
Size Constraint (does not work based on parent)
min-w: minimum widthmin-h: minimum heightmax-w: maximum widthmax-h: maximum height
Automatic Size
size-auto: sets both width and heightw-auto: widthh-auto: height
Visibility
hidden
Text Scale
text-auto
Text Size
text-xstext-lgtext-xltext-2xltext-3xltext-4xltext-4xltext-6xltext-7xltext-8xltext-9xl
Text Align
text-lefttext-centertext-right
ZIndex
z
Flex
flexflex-colflex-row
Justify
justify-startjustify-centerjustify-end
Align
items-startitems-centeritems-end
Gap
gap
Custom Values
You can add your custom values for some classes, currently support: colors | borderRadius | borderWidth | size
// Add
CssConfig.addValues("colors", {
primary: {
test: "#9400D3",
}
})
// Replace (This will replace all colors object with your custom)
CssConfig.setValues("colors", {
red: {
50: #fef2f2,
100: #fee2e2,
...values
}
...otherColors
})Usage
To use these classes, simply add them to your components as you would with TailwindCSS, and they will be applied with the corresponding Roblox UI transformations.
Feel free to contribute or raise issues if you find any bugs or have feature requests. Enjoy using @nico2433/rbxts-react-utils!
