s&box docs

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.

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;

Custom Style Properties

NameParametersExamples / Notes
aspect-ratioFloat, Float (Optional)aspect-ratio: 1;,aspect-ratio: 16/9;
background-image-tintColorMultiplies the background-image by this Color. Not a replacement for filter or backdrop-filter.
border-image-tintColorMultiplies the border-image by this Color.
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-strokeLength, ColorThis will put an outline
text-stroke-colorColor
text-stroke-widthLength

Supported Style Properties

NameParametersExamples / Notes
align-contentautoflex-endflex-startcenterstretchspace-betweenspace-aroundbaseline
align-itemsSame as align-content
align-selfSame as align-content
animationFills in the properties below
animation-delayFloat
animation-directionnormal (default) reverse alternate alternate-reverse
animation-durationFloat
animation-fill-modenone forwardsbackwardsboth
animation-iteration-countint / infinite
animation-nameString
animation-play-staterunningpaused
animation-timing-functionlinear (default) ease ease-in ease-out ease-in-out
backdrop-filterblur(Length) saturate(Length) contrast(Length) brightness(Length) grayscale(Length) sepia(Length) hue-rotate(Length) invert(Length) border-wrap(Length, Color)backdrop-filter: blur(10px) saturate(80%);
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 lighten multiply
background-colorColor
background-imageurl(string) linear-gradient(Color, Color) radial-gradient(Color, Color) 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
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-imageSame as background-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;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
bottomLength
box-shadowLength,Length (optional),Length (blur, optional),Length (spread, optional),Colorbox-shadow: 2px 2px 4px black;
colorColor /linear-gradient(Color, Color) /radial-gradient(Color, Color) /conic-gradient(Color, Color)
column-gapLength
contentstringSets the text of a Label.eg. content: "Loadingโ€ฆ";
cursornone / pointer / progress / wait / crosshair / text / move / not-allowed / any custom cursors
display*flex (default) / noneEverything is flex by default
filterSame as backdrop-filter
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-tintLength
flex-basisLength
flex-directionrow (default) / row-reverse / column / column-reverse
flex-growFloat
flex-shrinkFloat
flex-wrapnowrap (Default) / wrap / wrap-reverse
font-colorColor
font-family*StringSpecify a single font, based on the name of the font itself, not the filename.eg. font-family: Comic Sans MS;
font-sizeLength
font-smoothauto / always / nevernever is good for pixel fonts
font-stylenormal (default) / italic
font-variant-numericnormal / tabular-nums
font-weightnormal (default) / bold / light / bolder / lighter / black / intfont-weight: bold;,font-weight: 300;
gapLength, Length (optional)Shorthand for row-gap and column-gap, specified the size of gutters.
heightLength
image-renderingauto (default) / anisotropic / bilinear / trilinear / point / pixelated / nearest-neighbour
justify-contentSame as align-content
leftLength
letter-spacingLength / normal
line-heightLength
marginFills in the properties below
margin-bottomLength
margin-leftLength
margin-rightLength
margin-topLength
maskShorthand for other mask properties
mask-angleLength
mask-imageSame as background-image
mask-modeluminance / alpha
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
opacityFloat
orderint
overflowvisible (default) / hidden / scroll
overflow-xSame as overflow
overflow-ySame as overflow
paddingFills in the properties below
padding-bottomLength
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
text-alignleft (default) / center / right
text-background-angleLength
text-decorationColor / Length / LineStyle, LineProperties can be in any order and you can have multiple lines.
text-decoration-colorColor
text-decoration-lineunderline / line-through / overlineMultiple properties can be set. eg. text-decoration-line: overline underline;
text-decoration-line-through-offsetLength
text-decoration-overline-offsetLength
text-decoration-skip-inkall / noneDecides whether the line decoration should draw above glyphs or not
text-decoration-thicknessLength
text-decoration-underline-offsetLength
text-overflowclip / ellipsis
text-shadowSame as box-shadow
text-transformnone (default) / capitalize / lowercase / uppercase
topLength
transformFills in the properties below
transform-originLength, Length, 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-delayFloat
transition-durationFloat
transition-propertyString
transition-timing-functionlinear (default) / ease / ease-in-out / ease-out / ease-in
white-spacenormal / nowrap / preUse pre to format tabs and newlines.
widthLength
word-breaknormal / break-all
word-spacingLength
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 );
	}
}

Referenced API

Canonical API pages mentioned in this guide.

Created at:
Updated at:

On this page