A assist chip is a small button that allows for contextual action input. Read more (here)[https://m3.material.io/components/chips/overview].
This function is a native constructor, with verbosity allowing for control over every configurable property at the cost of a less convenient calling.
- onClick: () -> () = This function is called on click.
- text: string
- icon: ImageData?
- textColor: Color3
- disabledTextColor: Color3
- isEnabled: boolean
- elevation: number
- schemeType: Enums.SchemeType
- fontData: FontData
- scale: number
No Framework
local onClick: () -> () = function() end -- calls function on click
local text: string = "Chip"
local icon: ImageData? = nil
local textColor: Color3 = Color3.new()
local disabledTextColor: Color3 = Color3.new()
local isEnabled: boolean = true
local elevation: number = 0
local schemeType: Enums.SchemeType = Enums.SchemeType.Light
local fontData: FontData = Types.FontData.new(Font.fromEnum(Enum.Font.SourceSans), 14)
local scale: number = 1
local assist = Synthetic.Component.Button.Chip.Assist.Wrapper.new()
assist.OnClick = onClick
assist.Text = text
assist.Icon = icon
assist.TextColor = textColor
assist.DisabledTextColor = disabledTextColor
assist.IsEnabled = isEnabled
assist.Elevation = elevation
assist.SchemeType = schemeType
assist.FontData = fontData
assist.Scale = scale
Fusion
local onClickState: Fusion.Value<() -> ()> = Value(function() end) -- calls function on click
local text: string = "Chip"
local iconState: Fusion.Value<ImageData?> = Value(nil)
local textColor: Color3 = Color3.new()
local disabledTextColorState: Fusion.Value<Color3> = Value(Color3.new())
local isEnabled: boolean = true
local elevationState: Fusion.Value<number> = Value(0)
local schemeType: Enums.SchemeType = Enums.SchemeType.Light
local fontDataState: Fusion.Value<FontData> = Value(Types.FontData.new(Font.fromEnum(Enum.Font.SourceSans), 14))
local scale: number = 1
local assist: GuiObject = Synthetic.Component.Button.Chip.Assist.Fusion.new(
onClickState,
text,
iconState,
textColor,
disabledTextColorState,
isEnabled,
elevationState,
schemeType,
fontDataState,
scale
)
Roact
local assist = Roact.createElement(Module.Roact.New, {
onClick = function() end, -- calls function on click
text = "Chip",
icon = nil,
textColor = Color3.new(),
disabledTextColor = Color3.new(),
isEnabled = true,
elevation = 0,
schemeType = Enums.SchemeType.Light,
fontData = Types.FontData.new(Font.fromEnum(Enum.Font.SourceSans), 14),
scale = 1,
})
Roact.mount(assist, parent)
This function is a style constructor, utilizing the "Style" type to reduce the number of parameters required for implementation.
- style: Style
- onClick: () -> () = This function is called on click.
- text: string
- icon: ImageData?
- elevation: number?
- isEnabled: boolean?
No Framework
local style: Style = Style.new(1, Enum.Font.SourceSans, "Light", Color3.new(0, 0.4, 0.7))
local onClick: () -> () = function() end -- calls function on click
local text: string = "Chip"
local icon: ImageData? = nil
local elevation: number? = 0
local isEnabled: boolean? = true
local assist = Synthetic.Component.Button.Chip.Assist.Wrapper.primary()
assist.Style = style
assist.OnClick = onClick
assist.Text = text
assist.Icon = icon
assist.Elevation = elevation
assist.IsEnabled = isEnabled
Fusion
local styleState: Fusion.Value<Style> = Value(Style.new(1, Enum.Font.SourceSans, "Light", Color3.new(0, 0.4, 0.7)))
local onClick: () -> () = function() end -- calls function on click
local textState: Fusion.Value<string> = Value("Chip")
local icon: ImageData? = nil
local elevationState: Fusion.Value<number?> = Value(0)
local isEnabled: boolean? = true
local assist: GuiObject = Synthetic.Component.Button.Chip.Assist.Fusion.primary(
styleState,
onClick,
textState,
icon,
elevationState,
isEnabled
)
Roact
local assist = Roact.createElement(Module.Roact.Primary, {
style = Style.new(1, Enum.Font.SourceSans, "Light", Color3.new(0, 0.4, 0.7)),
onClick = function() end, -- calls function on click
text = "Chip",
icon = nil,
elevation = 0,
isEnabled = true,
})
Roact.mount(assist, parent)