ui.Slider
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เป้าหมายที่ลากได้ซึ่งมีช่วงเชิงเส้นระหว่างค่าตัวเลข 2 ค่า ค่าของแถบเลื่อนจะแสดงเป็นป้ายกำกับข้างแถบเลื่อน
การใช้งาน | การคืนสินค้า |
---|
ui.Slider(min, max, value, step, onChange, direction, disabled, style) | ui.Slider |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
min | หมายเลข (ไม่บังคับ) | ค่าต่ำสุด ค่าเริ่มต้นคือ 0 |
max | หมายเลข (ไม่บังคับ) | ค่าสูงสุด ค่าเริ่มต้นคือ 1 |
value | หมายเลข (ไม่บังคับ) | ค่าเริ่มต้น ค่าเริ่มต้นคือ 0 |
step | หมายเลข (ไม่บังคับ) | ขนาดของขั้นสำหรับแถบเลื่อน ค่าเริ่มต้นคือ 0.01 |
onChange | ฟังก์ชัน (ไม่บังคับ) | การเรียกกลับที่จะเรียกใช้เมื่อสถานะของแถบเลื่อนเปลี่ยนแปลง ระบบจะส่งค่าปัจจุบันของแถบเลื่อนและวิดเจ็ตแถบเลื่อนไปยังฟังก์ชันเรียกกลับ |
direction | สตริง ไม่บังคับ | ทิศทางของแถบเลื่อน โดยอาจเป็น "horizontal" หรือ "vertical" ค่าเริ่มต้นคือ "แนวนอน" |
disabled | บูลีน ไม่บังคับ | ปิดใช้แถบเลื่อนหรือไม่ ค่าเริ่มต้นคือ false |
style | ออบเจ็กต์ (ไม่บังคับ) | ออบเจ็กต์ของสไตล์ CSS ที่อนุญาตพร้อมค่าที่จะตั้งค่าสำหรับวิดเจ็ตนี้ ดูเอกสารประกอบเกี่ยวกับ style() |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 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. |"]]