Advertising sustains the DA. Ads are hidden for members. Join today

On this page

Basic functionality

Last updated on
23 September 2025

This documentation needs work. See "Help improve this page" in the sidebar.

Form API example

Notes on 3.x:

  • The #data-orientation is replaced with #orientation. You can still use #data-orientation but it will be deprecated soon.
  • A a new #dir attribute is available defaulting to ltr
$form['example'] = [
  '#type' => 'range_slider',
  '#title' => 'Rangeslider element',
  '#min' => 5,
  '#max' => 30,
  '#step' => 2,
  '#default_value' => 12,
  '#description' => 'Example range slider form element.',
  '#dir' => 'rtl', // Only available in 3.x
  '#orientation' => 'horizontal', // Only available in 3.x
  '#data-orientation' => 'horizontal',
  '#output' => 'below',
  '#output__field_prefix' => '$',
  '#output__field_suffix' => 'USD',
];

Help improve this page

Page status: Needs work

You can: