Skip to Content

Lui.Button

Creates a Button.

Lui.Button("Play", "px-6 py-3 rounded-lg bg-primary hover:bg-blue-400 active:scale-95 text-white transition", OnPlay)

Buttons are unstyled by default. Always provide classes.

Buttons can also use sprite or texture backgrounds when class-based bg-* colors are not enough for a skinned UI:

Lui.Button("Play", "w-64 h-20 text-white text-center text-middle", OnPlay) .Background(buttonSprite)

All supported background helpers:

.Background(sprite) .Background(sprite, useSpriteBorder: true, sliceScale: 1f) .Background(sprite, new Vector4(left, bottom, right, top)) .Background(sprite, new Vector4(left, bottom, right, top), sliceScale: 1f) .Background(texture) .Background(texture, new Vector4(left, bottom, right, top)) .Background(texture, new Vector4(left, bottom, right, top), sliceScale: 1f) .HoverBackground(hoverSprite) .ActiveBackground(activeSprite)

Sprite backgrounds use the sprite’s imported border for 9-slice scaling by default. Pass useSpriteBorder: false to ignore the imported border, or pass explicit slices in left, bottom, right, top texture-pixel order. sliceScale multiplies the slice values.

Lui.Button("Play", "w-64 h-20 text-white", OnPlay) .Background(normalSprite) .HoverBackground(hoverSprite) .ActiveBackground(pressedSprite)

ActiveBackground only accepts a Sprite, and active state wins over hover state.

Last updated on