API Reference
Core Composers
Animation Composer ($animation)
$animation
.property(property, steps) // Animate a specific property
.duration(duration) // Set animation duration
.delay(delay) // Set animation delay
.easing(easing) // Set animation timing function
.fillMode(mode) // Set animation fill mode
.iterationCount(count) // Set animation iteration countPreset Animations
fadeIn- Fade in animationfadeOut- Fade out animationslideUpFromBottom(by)- Slide up from bottomslideDownFromTop(by)- Slide down from topslideLeftFromRight(by)- Slide left from rightslideRightFromLeft(by)- Slide right from leftzoomIn(scale)- Zoom in animationzoomOut(scale)- Zoom out animationspin- Continuous rotation animationinfinite- Make animation loop infinitely
Property Animations
rotate(angles)- Animate rotationx(steps)- Animate X positiony(steps)- Animate Y positionscale(steps)- Animate scaleblur(steps)- Animate bluropacity(steps)- Animate opacity
Color Composer ($color)
$color(color)
.define(value) // Define color configuration
.color(value) // Set color value
.opacity(value) // Set opacity
.outputType(value) // Set output type (inline/background/color/border/outline/fill)Color Modifiers
secondary- Use secondary colortertiary- Use tertiary colortransparent- Make color transparentinteractive- Enable interactive stateshover- Apply hover stateactive- Apply active statemuted- Apply muted statehighlight(ratio)- Adjust color brightnessforeground- Use as foreground color
Output Types
asBg- Use as backgroundasColor- Use as text colorasBorder- Use as border colorasOutline- Use as outline colorasFill- Use as fill colorwithBorder- Add border
Common Composer ($common)
Layout
width(width)- Set widthheight(height)- Set heightsize(size)- Set both width and heightfullWidth- Set width to 100%fullHeight- Set height to 100%square- Make element squarecircle- Make element circularaspectRatio(ratio)- Set aspect ratio
Positioning
relative- Set position relativeabsolute- Set position absolutefixed- Set position fixedz(z)- Set z-indexleft(left)- Set left positionright(right)- Set right positiontop(top)- Set top positionbottom(bottom)- Set bottom positioninset(inset)- Set all positions
Spacing
p(value)- Set padding on all sidespx(value)- Set horizontal paddingpy(value)- Set vertical paddingpt(value)- Set top paddingpb(value)- Set bottom paddingpl(value)- Set left paddingpr(value)- Set right paddingm(value)- Set margin on all sidesmx(value)- Set horizontal marginmy(value)- Set vertical marginmt(value)- Set top marginmb(value)- Set bottom marginml(value)- Set left marginmr(value)- Set right margin
Other
disabled- Apply disabled stateround- Add border radiusnotSelectable- Prevent text selectioncursor(cursor)- Set cursor styleoverflowHidden- Hide overflowlineClamp(lines)- Limit text to number of lines
Flex Composer ($flex)
$flex
.direction(direction) // Set flex direction
.wrap(wrap) // Set flex wrap
.justify(justify) // Set justify content
.align(align) // Set align items
.gap(gap) // Set gap between items
.order(order) // Set order
.grow(grow) // Set flex grow
.shrink(shrink) // Set flex shrink
.basis(basis) // Set flex basisDirection
row- Set flex direction to rowcolumn- Set flex direction to columnhorizontal- Alias for rowvertical- Alias for columnx- Alias for rowy- Alias for columnreverse- Reverse flex direction
Alignment
alignCenter- Center items verticallyalignStart- Align items to startalignEnd- Align items to endalignStretch- Stretch items verticallyalignBaseline- Align items to baseline
Justification
justifyCenter- Center items horizontallyjustifyStart- Justify items to startjustifyEnd- Justify items to endjustifyBetween- Space items betweenjustifyAround- Space items aroundjustifyEvenly- Space items evenly
Other
center- Center items both vertically and horizontallywrap- Enable flex wrapinline- Make flex container inline
Font Composer ($font)
$font
.family(family) // Set font family
.size(size) // Set font size
.weight(weight) // Set font weight
.style(style) // Set font style
.lineHeight(height) // Set line height
.letterSpacing(spacing) // Set letter spacing
.align(align) // Set text align
.decoration(decoration) // Set text decoration
.transform(transform) // Set text transform
.whitespace(whitespace) // Set whitespace handlingLine Height
copyLineHeight- Set line height for copy textheadingLineHeight- Set line height for headingsbalance- Balance text linesresetLineHeight- Reset line height
Text Transform
uppercase- Transform text to uppercaselowercase- Transform text to lowercasecapitalize- Capitalize text
Text Decoration
underline- Add underline
Text Alignment
left- Align text leftcenter- Align text centerright- Align text right
Font Weight
w100throughw900- Set font weight (100-900)normal- Set normal font weight
Other
ellipsis- Add text ellipsisnowrap- Prevent text wrappingantialiased- Enable font smoothingsecondary- Use secondary fonttertiary- Use tertiary font
Grid Composer ($grid)
$grid
.template(template) // Set grid template
.columns(columns) // Set grid columns
.rows(rows) // Set grid rows
.gap(gap) // Set grid gap
.area(area) // Set grid area
.column(column) // Set grid column
.row(row) // Set grid row
.start(start) // Set grid start
.end(end) // Set grid end
.span(span) // Set grid spanAlignment
alignItemsCenter- Center items verticallyalignItemsStart- Align items to startalignItemsEnd- Align items to endalignItemsStretch- Stretch items vertically
Justification
justifyItemsCenter- Center items horizontallyjustifyItemsStart- Justify items to startjustifyItemsEnd- Justify items to endjustifyItemsStretch- Stretch items horizontally
Content Alignment
alignContentCenter- Center contentalignContentStart- Align content to startalignContentEnd- Align content to endalignContentStretch- Stretch contentalignContentBetween- Space content betweenalignContentAround- Space content aroundalignContentEvenly- Space content evenly
Flow
flowRow- Set grid auto-flow to rowflowColumn- Set grid auto-flow to columnflowRowDense- Set grid auto-flow to row denseflowColumnDense- Set grid auto-flow to column dense
Other
center- Center grid itemsinline- Make grid container inline
Shadow Composer ($shadow)
$shadow
.define(value) // Define shadow configuration
.color(color) // Set shadow color
.blur(blur) // Set shadow blur
.spread(spread) // Set shadow spread
.offset(offset) // Set shadow offset
.inset(value) // Set shadow inset
.opacity(value) // Set shadow opacitySize Composer ($size)
$size
.base(value) // Set base size
.rem(value) // Set size in rem units
.level(level) // Set size level
.px(value) // Set size in pixels
.em(value) // Set size in em unitsSize Properties
width- Set widthheight- Set heightsize- Set both width and heightminSize- Set minimum sizemaxSize- Set maximum sizeminWidth- Set minimum widthmaxWidth- Set maximum widthminHeight- Set minimum heightmaxHeight- Set maximum height
Spacing Properties
marginX- Set horizontal marginmarginY- Set vertical marginmarginTop- Set top marginmarginBottom- Set bottom marginmarginLeft- Set left marginmarginRight- Set right marginmargin- Set all marginspaddingX- Set horizontal paddingpaddingY- Set vertical paddingpaddingTop- Set top paddingpaddingBottom- Set bottom paddingpaddingLeft- Set left paddingpaddingRight- Set right paddingpadding- Set all paddinggap- Set gap
Transform Properties
transformX- Set X transformtransformY- Set Y transformtransformXY- Set both X and Y transform
Surface Composer ($surface)
$surface(config)
.padding(padding) // Set padding
.radius(radius) // Set border radius
.shadow(shadow) // Set box shadowProperties
padding- Set paddingpaddingX- Set horizontal paddingpaddingY- Set vertical paddingradius- Set border radiusheight- Set heightwidth- Set widthcircle- Make surface circularsize- Set both width and height
Padding Removal
noPT- Remove top paddingnoPB- Remove bottom paddingnoPL- Remove left paddingnoPR- Remove right padding
Transition Composer ($transition)
$transition
.property(property) // Set transition property
.duration(duration) // Set transition duration
.delay(delay) // Set transition delay
.easing(easing) // Set transition timing functionPreset Transitions
slowRelease- Slow release transitionall- Transition all propertiescolors- Transition color propertiescommon- Common transition properties
Theme System
Theme Creation
createTheme<T extends ComposableThemeInputObject>(themeInput: T): ComposableTheme<T>Theme Variants
createThemeVariant<T extends ComposableThemeInputObject>(
sourceTheme: ComposableTheme<T>,
variantInput: ThemeVariantInputObject<T>
): ThemeVariant<T>Theme Composition
composeThemeVariants<T extends ComposableThemeInputObject>(
sourceTheme: ComposableTheme<T>,
variants: ThemeVariant<T>[]
): ThemeVariant<T>Themed Values
createThemedValue<V extends ThemedValueInput>(
path: string,
defaultValue: V
): ThemedValue<V>Utility Functions
Style Resolution
resolveStylesInput(styles?: StylesInput): Array<AnyStyledComposer>Theme Hooks
useThemeValue<T>(themedValue: ThemedValueGetter<T>): TBuilt-in Components
The library provides a comprehensive set of styled HTML and SVG components through the UI export:
import { UI } from 'stylings'
// HTML Elements
<UI.div>...</UI.div>
<UI.button>...</UI.button>
<UI.input />
<UI.form>...</UI.form>
// SVG Elements
<UI.svg>...</UI.svg>
<UI.path />
<UI.circle />All components support the following props:
as- Change the underlying HTML elementstyles- Apply styles using composers
Last updated on