ui.Slider
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Przeciągany cel, który zmienia się liniowo między dwiema wartościami liczbowymi. Wartość suwaka jest wyświetlana jako etykieta obok niego.
Wykorzystanie | Zwroty |
---|
ui.Slider(min, max, value, step, onChange, direction, disabled, style) | ui.Slider |
Argument | Typ | Szczegóły |
---|
min | Numer, opcjonalny | Wartość minimalna. Domyślna wartość to 0. |
max | Numer, opcjonalny | Wartość maksymalna. Domyślna wartość to 1. |
value | Numer, opcjonalny | Wartość początkowa. Domyślna wartość to 0. |
step | Numer, opcjonalny | Wielkość kroku suwaka. Domyślna wartość to 0,01. |
onChange | Funkcja (opcjonalnie) | Funkcja wywołania zwrotnego, która ma zostać uruchomiona, gdy zmieni się stan suwaka. Funkcja wywołania zwrotnego otrzymuje bieżącą wartość suwaka i widżet suwaka. |
direction | Ciąg znaków, opcjonalnie | Kierunek suwaka. Jedna z wartości „horizontal” lub „vertical”. Domyślna wartość to „horizontal”. |
disabled | Wartość logiczna, opcjonalna | Określa, czy suwak jest wyłączony. Wartość domyślna to fałsz. |
style | Obiekt (opcjonalnie) | Obiekt dozwolonych stylów CSS z wartościami, które mają być ustawione dla tego widżetu. Zobacz dokumentację funkcji style(). |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eui.Slider\u003c/code\u003e widget enables users to interactively select a numeric value within a defined range, visually represented by a draggable slider.\u003c/p\u003e\n"],["\u003cp\u003eIt offers customization options like minimum/maximum values, step size, initial value, orientation, and an onChange callback to respond to user interactions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can further tailor its appearance using custom CSS styles through the \u003ccode\u003estyle\u003c/code\u003e argument.\u003c/p\u003e\n"]]],["The `ui.Slider` component creates a draggable slider between a minimum (`min`) and maximum (`max`) numeric value. It displays the current `value` with a label, adjustable by a defined `step`. The `direction` can be horizontal or vertical. An optional `onChange` function triggers on value changes, passing the current value. The slider can be `disabled`, and `style` properties are customizable. Default values are provided for `min`, `max`, `value`, and `step`.\n"],null,["# ui.Slider\n\n\u003cbr /\u003e\n\nA draggable target that ranges linearly between two numeric values. The value of the slider is displayed as a label alongside it.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------|-----------|\n| `ui.Slider(`*min* `, `*max* `, `*value* `, `*step* `, `*onChange* `, `*direction* `, `*disabled* `, `*style*`)` | ui.Slider |\n\n| Argument | Type | Details |\n|-------------|--------------------|------------------------------------------------------------------------------------------------------------------------------|\n| `min` | Number, optional | The minimum value. Defaults to 0. |\n| `max` | Number, optional | The maximum value. Defaults to 1. |\n| `value` | Number, optional | The initial value. Defaults to 0. |\n| `step` | Number, optional | The step size for the slider. Defaults to 0.01. |\n| `onChange` | Function, optional | A callback to fire when the slider's state changes. The callback is passed the slider's current value and the slider widget. |\n| `direction` | String, optional | The direction of the slider. One of 'horizontal' or 'vertical'. Defaults to 'horizontal'. |\n| `disabled` | Boolean, optional | Whether the slider is disabled. Defaults to false. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. See style() documentation. |"]]