UI

Style Properties

We try to keep as close to standard web styles as possible - but not every property is implemented. We'll use this page to highlight any differences.

Anything marked in bold* may behave differently to how you'd expect on web.

Common Types

NameDescriptionExamples
FloatA standard floatflex-grow: 2.5;
StringA string with or without quotesfont-family: Poppins;,content: "Back to Menu";
intA standard intfont-weight: 600;
ColorCan have alphacolor: #fff;,color: #ffffffaa;,color: rgba(red, 0.5);
LengthA dimension, pixel or relative.left: 10px;,left: 10%;,left: 10em;,left: 10vw;,mask-angle: 10deg;

Value Syntax & Units

These work across most properties:

FeatureDescriptionExamples
min() / max() / clamp()Math functions usable anywhere a Length is accepted.width: min(100px, 50%);,width: clamp(10px, 50%, 200px);
CSS-wide keywordsinherit, initial, unset and revert are accepted on single-value properties and most shorthands (margin, border, background, filter, animation, …). Not on box-shadow, text-shadow, filter-drop-shadow, background-image, mask-image, border-image, transition* or flex.color: inherit;,margin: unset;
currentColorResolves to the element's current color value.border-color: currentColor;
oklch() / lab() / hwb()Additional color syntaxes, on top of hex / rgb() / rgba().color: oklch(0.7 0.15 200);
Viewport unitsdvh, svh, lvh and dvw are treated the same as vh / vw.height: 100dvh;
Time unitsDurations accept ms as well as s.transition: opacity 200ms ease;,animation-duration: 500ms;

Custom Style Properties

NameParametersExamples / Notes
aspect-ratioFloat, Float (Optional) / autoaspect-ratio: 1;,aspect-ratio: 16/9;,aspect-ratio: auto;
background-image-tintColorMultiplies the background-image by this Color. Not a replacement for filter or backdrop-filter. background-tint is an alias.
background-playback-staterunning (default) / pausedPauses an animated or video background-image.
border-image-tintColorMultiplies the border-image by this Color.
border-shapenone / polygon(x y, ...) / circle(radius at x y)Replaces the rounded rectangle with a polygon (3-8 points) or a circle, for backgrounds, borders and hit testing. See Border Shape.
mask-scopedefault / filterdefault will apply the mask normally, filter will use the mask to blend between unfiltered and filtered.
sound-inStringThe name of the sound to play when this style is applied to an element. This is useful to put on a :hover or :active style to play a sound on hover/click
sound-outStringThe name of a sound to play when this style is removed from an element.
text-filterbilinear (default) / linear / point / trilinear / anisotropicTexture filtering for text. point is good for pixel fonts.
text-strokeLength, ColorThis will put an outline
text-stroke-colorColor
text-stroke-widthLength

Supported Style Properties

NameParametersExamples / Notes
align-contentauto / flex-start / flex-end / center / stretch / space-between / space-around / space-evenly / start / end / self-start / self-end / normal / baselinestart/self-start map to flex-start, end/self-end to flex-end, normal to stretch.
align-itemsSame as align-content
align-selfSame as align-content
animationFills in the properties below
animation-delayTime (s / ms)A unit is required. eg. animation-delay: 200ms;
animation-directionnormal (default) / reverse / alternate / alternate-reverse
animation-durationTime (s / ms)A unit is required. eg. animation-duration: 0.5s;
animation-fill-modenone (default) / forwards / backwards / both
animation-iteration-countint / infinite
animation-nameString
animation-play-staterunning (default) / paused
animation-timing-functionSame as transition-timing-function
backdrop-filterblur(Length) <br>saturate(Length) <br>contrast(Length) <br>brightness(Length) <br>grayscale(Length) <br>sepia(Length) <br>hue-rotate(Length) <br>invert(Length) / nonebackdrop-filter: blur(10px) saturate(80%); none clears any backdrop filters.
backdrop-filter-blurLength
backdrop-filter-brightnessLength
backdrop-filter-contrastLength
backdrop-filter-hue-rotateLength
backdrop-filter-invertLength
backdrop-filter-saturateLength
backdrop-filter-sepiaLength
backgroundFills in the properties below
background-angleLength
background-blend-modenormal (default) / lighten / multiply
background-clipborder-box (default) / padding-box / content-box / texttext paints the background only where the text is, so it shows through the glyphs.
background-colorColor
background-imageurl(string) <br>linear-gradient(Color, Color) <br>radial-gradient(Color, Color) <br>conic-gradient(Color, Color)
background-positionLength, Length (optional)background-position: 10px``background-position: 10px 15px
background-position-xLength
background-position-yLength
background-repeatno-repeat / repeat-x / repeat-y / repeat / round / clamp
background-sizeLength, Length (optional)background-size: 10px background-size: 10px 15px
background-size-xLength
background-size-yLength
borderborder-width, border-style, border-colorborder: 10px solid black;
border-bottomSame as border
border-bottom-colorColor
border-bottom-left-radiusLength
border-bottom-right-radiusLength
border-bottom-widthLength
border-colorColor
border-imageurl(String) / gradient (as background-image), Length (slice, 1–4, optional) / Length (width, 1–4, optional), stretch / round, fillborder-image: url( border.png ) 20px / 10px round fill; The slice defaults to a third of the image.
border-image-tintColor
border-image-width-bottomLength
border-image-width-leftLength
border-image-width-rightLength
border-image-width-topLength
border-leftSame as border
border-left-colorColor
border-left-widthLength
border-radiusLengthborder-radius: 8px;<br>border-radius: 8px 0px 8px 8px;
border-rightSame as border
border-right-colorColor
border-right-widthLength
border-topSame as border
border-top-colorColor
border-top-left-radiusLength
border-top-right-radiusLength
border-top-widthLength
border-widthLength (1–4 values)Accepts 1–4 values like the CSS shorthand. eg. border-width: 1px;,border-width: 1px 2px;,border-width: 1px 2px 3px 4px;
bottomLength
box-shadowLength (x),<br>Length (y),<br>Length (blur, optional),<br>Length (spread, optional),<br>Colorbox-shadow: 2px 2px 4px black;
caret-colorColorThe text cursor in a TextEntry. Defaults to the text colour.
colorColor /<br>linear-gradient(Color, Color) /<br>radial-gradient(Color, Color)
column-gapLength
contentstringSets the text of a Label.<br>eg. content: "Loading…";
cursornone / pointer / progress / wait / crosshair / text / move / not-allowed / any custom cursors
display*flex (default) / none / contentsEverything is flex by default
filterSame as backdrop-filter, plus <br>tint(Color) <br>drop-shadow(Same as box-shadow) <br>border-wrap(Length, Color) / nonefilter: blur(2px) tint(#f00); none clears any filters.
filter-blurLength
filter-border-colorColor
filter-border-widthLength
filter-brightnessLength
filter-contrastLength
filter-drop-shadowSame as box-shadow
filter-hue-rotateLength
filter-invertLength
filter-saturateLength
filter-sepiaLength
filter-tintColor
flex-basisLength
flex-directionrow (default) / row-reverse / column / column-reverse
flex-flowflex-direction, flex-wrapShorthand for flex-direction and flex-wrap. eg. flex-flow: row wrap;
flex-growFloat
flex-shrinkFloat
flex-wrapnowrap (Default) / wrap / wrap-reverse
fontFills in the font properties belowShorthand for font-style, font-weight, font-size, line-height and font-family. eg. font: italic bold 16px/1.4 Poppins;
font-colorColor
font-family*StringSpecify a single font, based on the name of the font itself, not the filename.<br>eg. font-family: Comic Sans MS;<br>Generic families (serif, sans-serif, monospace) are mapped to a default font.
font-sizeLength / xx-small / x-small / small / medium / large / x-large / xx-large / xxx-large
font-smoothauto / always / never / nonenever is good for pixel fonts
font-stylenormal (default) / italic / oblique
font-variant-numericnormal / tabular-nums
font-weightint / hairline / thin / ultralight / extralight / light / regular / normal (default) / medium / demibold / semibold / bold / extrabold / heavy / black / extrablack / ultrablack / bolder / lighterfont-weight: bold;,font-weight: 300;
gapLength, Length (optional) / normalShorthand for row-gap and column-gap, specified the size of gutters.
heightLength
image-renderingauto (default) / anisotropic / bilinear / trilinear / point / pixelated / nearest-neighbor / crisp-edgescrisp-edges uses point sampling.
insetLength (1–4 values)Shorthand for top, right, bottom and left.
inset-blockLength, Length (optional)Shorthand for inset-block-start and inset-block-end.
inset-block-endLength
inset-block-startLength
inset-inlineLength, Length (optional)Shorthand for inset-inline-start and inset-inline-end.
inset-inline-endLength
inset-inline-startLength
isolationauto (default) / isolateisolate forces a new stacking context.
justify-contentflex-start (default) / flex-end / center / stretch / space-between / space-around / space-evenly / start / end / left / right / normalstart/left/normal/stretch map to flex-start, end/right to flex-end.
leftLength
letter-spacingLength / normal
line-heightLength
marginFills in the properties below
margin-blockLength, Length (optional)Shorthand for margin-block-start and margin-block-end.
margin-block-endLength
margin-block-startLength
margin-bottomLength
margin-inlineLength, Length (optional)Shorthand for margin-inline-start and margin-inline-end.
margin-inline-endLength
margin-inline-startLength
margin-leftLength
margin-rightLength
margin-topLength
maskShorthand for other mask properties
mask-angleLength
mask-imageSame as background-image
mask-modealpha / luminance / match-source
mask-positionLength, Length (optional)
mask-position-xLength
mask-position-yLength
mask-repeatsame as background-repeat
mask-sizeLength, Length (optional)
mask-size-xLength
mask-size-yLength
max-heightLength
max-widthLength
min-heightLength
min-widthLength
mix-blend-modenormal / lighten / multiply
object-fitfill / contain / cover (default) / none / scale-downscale-down is treated as contain.
opacityFloat / Percentageopacity: 0.5;,opacity: 50%;
orderint
outlineoutline-width, outline-style, outline-colorSame syntax as border. Drawn outside the box, offset by outline-offset. eg. outline: 2px solid #08f;
outline-colorColor
outline-offsetLength
outline-widthLength
overflowvisible (default) / hidden / scroll / auto / clip / clip-wholeauto maps to scroll. clip clips like hidden without making a scroll container. clip-whole hides any child that extends outside the box entirely, rather than clipping it.
overflow-xSame as overflow
overflow-ySame as overflow
paddingFills in the properties below
padding-blockLength, Length (optional)Shorthand for padding-block-start and padding-block-end.
padding-block-endLength
padding-block-startLength
padding-bottomLength
padding-inlineLength, Length (optional)Shorthand for padding-inline-start and padding-inline-end.
padding-inline-endLength
padding-inline-startLength
padding-leftLength
padding-rightLength
padding-topLength
perspective-originLength, Length (optional)
perspective-origin-xLength
perspective-origin-yLength
pointer-eventsnone (default) / all / auto
position*static (default) / relative / absoluteSee how it works: https://yogalayout.com/docs/absolute-relative-layout/
rightLength
row-gapLength
scrollbar-color*Color, Color (optional) / autoThumb colour then track colour. auto clears both. Inherited.
scrollbar-gutterauto (default) / stable / stable both-edgesstable reserves the vertical bar's width so content is laid out beside it instead of under it.
scrollbar-width*auto / thin / none (default) / LengthZero or none means no bar. Unlike the web it's inherited, so one rule on a root turns bars on for a whole tree, and a child can opt out with none.
text-alignleft (default) / center / right / justify / start / end
text-background-angleLength
text-decorationColor / Length / LineStyle, LineProperties can be in any order and you can have multiple lines.
text-decoration-colorColor
text-decoration-linenone / underline / line-through / overlineMultiple properties can be set. eg. text-decoration-line: overline underline;
text-decoration-skip-inkauto / all / noneDecides whether the line decoration should draw above glyphs or not
text-decoration-stylesolid (default) / double / dotted / dashed / wavy
text-decoration-thicknessLength
text-line-through-offsetLength
text-overflowclip / ellipsis
text-overline-offsetLength
text-shadowSame as box-shadow
text-transformnone (default) / capitalize / lowercase / uppercase
text-underline-offsetLength
topLength
transformFills in the properties belowscale() accepts comma-separated arguments. eg. transform: scale(2, 0.5);
transform-originLength, Length (optional)
transform-origin-xLength
transform-origin-yLength
transitionFills in the properties belowtransition: all 0.1s ease;,transition: opacity 0.1s, transform 0.2s ease-out;
transition-delayTime (s / ms)A unit is required. eg. transition-delay: 200ms;
transition-durationTime (s / ms)A unit is required. eg. transition-duration: 0.5s;
transition-propertyString
transition-timing-functionease (default) / linear / ease-in / ease-out / ease-in-out / bounce-in / bounce-out / bounce-in-out / sin-ease-in / sin-ease-out / sin-ease-in-out / step-start / step-end / cubic-bezier(x1, y1, x2, y2) / steps(n, start / end)Use cubic-bezier() and steps(n, end) in the transition / animation shorthands or animation-timing-function; this longhand splits its value on commas, so they don't parse here.
white-spacenormal / nowrap / pre / pre-wrap / pre-line / break-spacesUse pre to format tabs and newlines.
widthLength
word-breaknormal / break-all / break-word / keep-all
word-spacingLength / normal
z-indexint

Custom Pseudo-Classes

These are some s&box-specific pseudo-classes which are useful for applying transitions when an element is created or deleted.

  • :intro is removed when the element is created, things will transition away from this
  • :outro is added when Panel.Delete() is called. The Panel waits for all transitions to finish before actually deleting itself.
MyPanel {
	transition: all 2s ease-out;
	transform: scale( 1 );

	// When the element is created make it expand from nothing.
	&:intro {
		transform: scale( 0 );
	}

	// When the element is deleted make it double in size before being deleted.
	&:outro {
		transform: scale( 2 );
	}
}

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2026-09-03. Read it rendered on the official docs.

More in UI

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.