FUISelect
extends FUIView
in package
Table of Contents
Properties
- $children : array<string|int, FUIView>
- An array of child views
- $label : string|null
- A Label string that will be rendered before the select
- $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
- $selectId : string
- Select ID
- $style : FUISelectStyle
- The style of the select
- $selectedOptionRef : string|null
- Reference to external selected option variable (if provided)
Methods
- __construct() : mixed
- Constructs a new select
- applyStyle() : self
- Applies the given select style
- getEstimatedSize() : Vec2
- Returns the estimated size of the select
- getSelectedOption() : string|null
- Gets the selected option
- hideLabel() : self
- Hides the label for the select
- 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 select
- setId() : self
- Sets the select ID
- setSelectedOption() : self
- Sets the selected option
- isOpen() : bool
- Whether the dropdown is currently open (stored in context for persistence)
- renderDropdown() : void
- Renders the dropdown list
- setOpen() : void
- Sets the dropdown open state
Properties
$children
An array of child views
public
array<string|int, FUIView>
$children
= []
$label
A Label string that will be rendered before the select
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
$selectId
Select ID
public
string
$selectId
$style
The style of the select
public
FUISelectStyle
$style
$selectedOptionRef
Reference to external selected option variable (if provided)
private
string|null
$selectedOptionRef
= null
Methods
__construct()
Constructs a new select
public
__construct(string $name, array<string, string> $options[, string|null &$selectedOption = null ][, Closure|null $onSelect = null ][, string|null $selectId = null ][, FUISelectStyle|null $selectStyle = null ]) : mixed
Parameters
- $name : string
-
The name of the select, 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
- $selectId : string|null = null
- $selectStyle : FUISelectStyle|null = null
applyStyle()
Applies the given select style
public
applyStyle(FUISelectStyle $style) : self
Parameters
- $style : FUISelectStyle
Return values
selfgetEstimatedSize()
Returns the estimated size of the select
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 select
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 select
public
render(FUIRenderContext $ctx) : void
Parameters
- $ctx : FUIRenderContext
setId()
Sets the select 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
Return values
selfisOpen()
Whether the dropdown is currently open (stored in context for persistence)
private
isOpen(FUIRenderContext $ctx) : bool
Parameters
- $ctx : FUIRenderContext
Return values
boolrenderDropdown()
Renders the dropdown list
private
renderDropdown(FUIRenderContext $ctx, float $x, float $y, float $width) : void
Parameters
- $ctx : FUIRenderContext
- $x : float
- $y : float
- $width : float
setOpen()
Sets the dropdown open state
private
setOpen(FUIRenderContext $ctx, bool $open) : void
Parameters
- $ctx : FUIRenderContext
- $open : bool