Slider
ポインターとキーボード操作をコアが管理する、単一または複数つまみの範囲入力です。
デモを読み込み中…
func SliderExample() *ui.Element {
volume, setVolume := ui.CreateSignal([]float64{40})
slider := ui.NewSlider(ui.SliderRootProps{Value: volume, Min: 0, Max: 100, Step: 1, OnValueChange: func(next []float64, _ *native.Event) {
setVolume(next)
}})
return slider.Root().Children(
slider.Label().Child("Volume"),
slider.Control().Width(240).Height(24).Children(
slider.Track().Child(slider.Indicator()),
slider.Thumb(),
),
slider.Value(),
)
}#インポート
github.com/egoist/quickgui/go/ui から ui をインポートします。
import (
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#使い方
func SliderExample() *ui.Element {
volume, setVolume := ui.CreateSignal([]float64{40})
slider := ui.NewSlider(ui.SliderRootProps{Value: volume, Min: 0, Max: 100, Step: 1, OnValueChange: func(next []float64, _ *native.Event) {
setVolume(next)
}})
return slider.Root().Children(
slider.Label().Child("Volume"),
slider.Control().Width(240).Height(24).Children(
slider.Track().Child(slider.Indicator()),
slider.Thumb(),
),
slider.Value(),
)
}#構成
slider.Rootslider.Labelslider.Valueslider.Controlslider.Trackslider.Rangeslider.Indicatorslider.Thumb
#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
NewSlider
ソースを見るui.NewSlider(props ...SliderRootProps) *SliderComponentNewSlider declares a Slider instance. Optional props provide initial settings.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Valuefunc() []float64—
The current controlled value. Update application state from the change callback to accept a new value.
func() []float64ソースを見るDefaultValue[]float64—
Initial value for uncontrolled state. Use Value when the application should own subsequent changes.
[]float64ソースを見るOnValueChangefunc([]float64, *native.Event)—
Reports an accepted value change. Use the callback payload to update controlled state.
func([]float64, *native.Event)ソースを見るOnValueCommittedfunc([]float64, *native.Event)—
Callback for value committed. The signature below lists the event payload.
func([]float64, *native.Event)ソースを見るMinany—
Maxany—
Stepany—
LargeStepany—
MinStepsBetweenValuesany—
ThumbAlignmentstring—
Formatstring—
Orientationstring—
Slider.Disabled
ソースを見るslider.Disabled(value any) *SliderComponentPrevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
Slider.SetValue
ソースを見るslider.SetValue(value any) *SliderComponentConfigures set value for this part. The declared type and source define the accepted value.
Slider.DefaultValue
ソースを見るslider.DefaultValue(value []float64) *SliderComponentInitial value for uncontrolled state. Use Value when the application should own subsequent changes.
Slider.OnValueChange
ソースを見るslider.OnValueChange(value func([]float64, *native.Event)) *SliderComponentReports an accepted value change. Use the callback payload to update controlled state.
Slider.OnValueCommitted
ソースを見るslider.OnValueCommitted(value func([]float64, *native.Event)) *SliderComponentCallback for value committed. The signature below lists the event payload.
Slider.Min
ソースを見るslider.Min(value any) *SliderComponentLower bound of the accepted value.
Slider.Max
ソースを見るslider.Max(value any) *SliderComponentUpper bound of the accepted value.
Slider.Step
ソースを見るslider.Step(value any) *SliderComponentIncrement applied by pointer, keyboard, or step controls.
Slider.LargeStep
ソースを見るslider.LargeStep(value any) *SliderComponentLarger increment used by accelerated keyboard adjustment.
Slider.MinStepsBetweenValues
ソースを見るslider.MinStepsBetweenValues(value any) *SliderComponentMinimum separation between neighboring slider thumbs, measured in steps.
Slider.ThumbAlignment
ソースを見るslider.ThumbAlignment(value string) *SliderComponentWhether the slider thumb stays inside the track or aligns its center to the edge.
Slider.Format
ソースを見るslider.Format(value string) *SliderComponentFormatting configuration or callback for the displayed value.
Slider.Orientation
ソースを見るslider.Orientation(value string) *SliderComponentDirection used for layout and keyboard navigation.
Slider.Root
ソースを見るslider.Root() *ElementConfigures root for this part. The declared type and source define the accepted value.
Slider.Label
ソースを見るslider.Label(options ...PartProps) *ElementVisible native SwiftUI control label.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Value
ソースを見るslider.Value(options ...PartProps) *ElementThe current controlled value. Update application state from the change callback to accept a new value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Control
ソースを見るslider.Control(options ...PartProps) *ElementConfigures control for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Track
ソースを見るslider.Track(options ...PartProps) *ElementConfigures track for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Range
ソースを見るslider.Range(options ...PartProps) *ElementConfigures range for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Indicator
ソースを見るslider.Indicator(options ...PartProps) *ElementConfigures indicator for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Slider.Thumb
ソースを見るslider.Thumb(options ...SliderThumbProps) *ElementConfigures thumb for this part. The declared type and source define the accepted value.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るStyleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
anyソースを見るChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildrenソースを見るDisabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
anyソースを見るRolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64ソースを見るOnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)ソースを見るOnDoubleClickfunc(*native.Event)—
OnContextMenufunc(*native.Event)—
OnPointerfunc(*native.Event)—
OnMouseEnterfunc(*native.Event)—
OnMouseLeavefunc(*native.Event)—
OnMouseDownfunc(*native.Event)—
OnMouseUpfunc(*native.Event)—
OnKeyDownfunc(*native.Event)—
OnKeyUpfunc(*native.Event)—
OnFocusfunc(*native.Event)—
OnBlurfunc(*native.Event)—
Index*int—
Element
ソースを見るpart.Child(content).Style(style)Every part returns a fluent element. Strings, numbers, elements, and deferred child factories compose directly.
ChildChild(child any) *Element—
Child appends content and returns this element. Content can be an element, native node, scalar, accessor, or node-returning construction callback.
Child(child any) *Elementソースを見るChildrenChildren(children ...any) *Element—
Children appends multiple children in order without replacing existing content. It also accepts []any, []*Element, and []*native.Node slices as arguments. Read the retained child nodes through element.Node.Children.
Children(children ...any) *Elementソースを見るStyleStyle(style StyleBuilder) *Element—
Style merges a reusable style. Scalar accessors retain independent native bindings.
Style(style StyleBuilder) *Elementソースを見るOnClickOnClick(handler func()) *Element—
RefRef(handler func(*native.Node)) *Element—
Ref exposes the native handle once at this point in the declaration chain.
Ref(handler func(*native.Node)) *Elementソースを見る