Utilities

Interactivity

Panda CSS provides a variety of utility classes to enhance interactivity and user experience on your web applications. These utilities cover aspects such as accent color, caret color, scrolling behavior, scrollbar customization, scroll margins and paddings, scroll snapping, touch actions, and user selection.

Accent Color

The accentColor utility class sets the accent color of an element. It supports colors tokens.

<div className={css({ accentColor: 'blue.500' })}>Accent color applied</div>

Caret Color

The caretColor utility class sets the color of the text cursor (caret) in an input or textarea. It supports colors tokens.

<input className={css({ caretColor: 'red.400' })} />

Scrollbar

The scrollbar utility allows customization of scrollbar appearance. It supports visible and hidden values which respectively show or hide the scrollbar.

<div className={css({ scrollbar: 'hidden' })}>Scrollbar hidden</div>

Scroll Margin

Scroll margin utilities set margins around scroll containers.

<div className={css({ scrollMarginX: '2' })}>
  Scrollbar Container with Inline padding
</div>
PropCSS PropertyToken Category
scrollMarginX ,scrollMarginInlinescroll-margin-inlinespacing
scrollMarginInlineStartscroll-margin-inline-startspacing
scrollMarginInlineEndscroll-margin-inline-endspacing
scrollMarginY , scrollMarginBlockscroll-margin-blockspacing
scrollMarginBlockStartscroll-margin-block-startspacing
scrollMarginBlockEndscroll-margin-block-endspacing
scrollMarginLeftscroll-margin-leftspacing
scrollMarginRightscroll-margin-rightspacing
scrollMarginTopscroll-margin-topspacing
scrollMarginBottomscroll-margin-bottomspacing

Scroll Padding

Scroll padding utilities set padding inside scroll containers.

<div className={css({ scrollPaddingY: '2' })}>
  Scrollbar Container with block padding
</div>
PropCSS PropertyToken Category
scrollPaddingX , scrollPaddingInlinescroll-padding-inlinespacing
scrollPaddingInlineStartscroll-padding-inline-startspacing
scrollPaddingInlineEndscroll-padding-inline-endspacing
scrollPaddingY , scrollPaddingBlockscroll-padding-blockspacing
scrollPaddingBlockStartscroll-padding-block-startspacing
scrollPaddingBlockEndscroll-padding-block-endspacing
scrollPaddingLeftscroll-padding-leftspacing
scrollPaddingRightscroll-padding-rightspacing
scrollPaddingTopscroll-padding-topspacing
scrollPaddingBottomscroll-padding-bottomspacing

Scroll Snapping

Scroll snapping utilities provide control over the scroll snap behavior.

Scroll Snap Margin

PropCSS PropertyToken Category
scrollSnapMarginscroll-marginspacing
scrollSnapMarginTopscroll-margin-topspacing
scrollSnapMarginBottomscroll-margin-bottomspacing
scrollSnapMarginLeftscroll-margin-leftspacing
scrollSnapMarginRightscroll-margin-rightspacing

Scroll Snap Strictness

It's values can be mandatory or proximity values, and maps to var(--scroll-snap-strictness).

<div className={css({ scrollSnapStrictness: 'proximity' })}>
  Scroll container with proximity scroll snap
</div>

Scroll Snap Type

Supported values

Value
nonenone
xx var(--scroll-snap-strictness)
yy var(--scroll-snap-strictness)
bothboth var(--scroll-snap-strictness)