FUIButtonGroup
extends FUIView
in package
Table of Contents
Properties
- $buttonGroupId : string
- Button group ID
- $children : array<string|int, FUIView>
- An array of child views
- $label : string|null
- A Label string that will be rendered before the button group
- $onSelect : Closure|null
- $options : array<string, string>
- $padding : Vec4
- Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding
- $selectedOption : string|null
- The currently selected option key
- $style : FUIButtonGroupStyle
- The style of the button group
- $selectedOptionRef : string|null
- Reference to external selected option variable (if provided)
Methods
- __construct() : mixed
- Constructs a new button group
- applyStyle() : self
- Applies the given button group style
- getEstimatedSize() : Vec2
- Returns the estimated size of the button group
- getSelectedOption() : string|null
- Gets the selected option
- hideLabel() : self
- Hides the label for the button group
- padding() : self
- Sets the views padding Padding is the space inside the view to its content
- paddingAll() : self
- Sets all padding values to the same value Padding is the space inside the view to its content
- paddingBottom() : self
- Sets the views bottom padding Padding is the space inside the view to its content
- paddingFull() : self
- Sets the views padding with individual values Padding is the space inside the view to its content
- paddingLeft() : self
- Sets the views left padding Padding is the space inside the view to its content
- paddingRight() : self
- Sets the views right padding Padding is the space inside the view to its content
- paddingTop() : self
- Sets the views top padding Padding is the space inside the view to its content
- paddingX() : self
- Sets the views horizontal padding (left and right) Padding is the space inside the view to its content
- paddingY() : self
- Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content
- render() : void
- Renders the button group
- setId() : self
- Sets the button group ID
- setSelectedOption() : self
- Sets the selected option
Properties
$buttonGroupId
Button group ID
public
string
$buttonGroupId
$children
An array of child views
public
array<string|int, FUIView>
$children
= []
$label
A Label string that will be rendered before the button group
public
string|null
$label
= null
$onSelect
public
Closure|null
$onSelect
= null
$options
public
array<string, string>
$options
Array of key => label pairs
$padding
Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding
public
Vec4
$padding
$selectedOption
The currently selected option key
public
string|null
$selectedOption
= null
$style
The style of the button group
public
FUIButtonGroupStyle
$style
$selectedOptionRef
Reference to external selected option variable (if provided)
private
string|null
$selectedOptionRef
= null
Methods
__construct()
Constructs a new button group
public
__construct(string $name, array<string, string> $options[, string|null &$selectedOption = null ][, Closure|null $onSelect = null ][, string|null $buttonGroupId = null ][, FUIButtonGroupStyle|null $buttonGroupStyle = null ]) : mixed
Parameters
- $name : string
-
The name of the button group, will also be used for the ID, so must be unique
- $options : array<string, string>
-
Array of key => label pairs
- $selectedOption : string|null = null
- $onSelect : Closure|null = null
- $buttonGroupId : string|null = null
- $buttonGroupStyle : FUIButtonGroupStyle|null = null
applyStyle()
Applies the given button group style
public
applyStyle(FUIButtonGroupStyle $style) : self
Parameters
- $style : FUIButtonGroupStyle
Return values
selfgetEstimatedSize()
Returns the estimated size of the button group
public
getEstimatedSize(FUIRenderContext $ctx) : Vec2
Parameters
- $ctx : FUIRenderContext
Return values
Vec2getSelectedOption()
Gets the selected option
public
getSelectedOption() : string|null
Return values
string|nullhideLabel()
Hides the label for the button group
public
hideLabel() : self
Return values
selfpadding()
Sets the views padding Padding is the space inside the view to its content
public
padding(float $horizontal, float $vertical) : self
Parameters
- $horizontal : float
- $vertical : float
Return values
selfpaddingAll()
Sets all padding values to the same value Padding is the space inside the view to its content
public
paddingAll(float $padding) : self
Parameters
- $padding : float
Return values
selfpaddingBottom()
Sets the views bottom padding Padding is the space inside the view to its content
public
paddingBottom(float $paddingBottom) : self
Parameters
- $paddingBottom : float
Return values
selfpaddingFull()
Sets the views padding with individual values Padding is the space inside the view to its content
public
paddingFull(float $left, float $right, float $top, float $bottom) : self
Parameters
- $left : float
- $right : float
- $top : float
- $bottom : float
Return values
selfpaddingLeft()
Sets the views left padding Padding is the space inside the view to its content
public
paddingLeft(float $paddingLeft) : self
Parameters
- $paddingLeft : float
Return values
selfpaddingRight()
Sets the views right padding Padding is the space inside the view to its content
public
paddingRight(float $paddingRight) : self
Parameters
- $paddingRight : float
Return values
selfpaddingTop()
Sets the views top padding Padding is the space inside the view to its content
public
paddingTop(float $paddingTop) : self
Parameters
- $paddingTop : float
Return values
selfpaddingX()
Sets the views horizontal padding (left and right) Padding is the space inside the view to its content
public
paddingX(float $paddingX) : self
Parameters
- $paddingX : float
Return values
selfpaddingY()
Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content
public
paddingY(float $paddingY) : self
Parameters
- $paddingY : float
Return values
selfrender()
Renders the button group
public
render(FUIRenderContext $ctx) : void
Parameters
- $ctx : FUIRenderContext
setId()
Sets the button group ID
public
setId(string $id) : self
Parameters
- $id : string
Return values
selfsetSelectedOption()
Sets the selected option
public
setSelectedOption(string|null $selectedOption) : self
Parameters
- $selectedOption : string|null