lara-light-indigo

Knob

Knob is a form component to define number inputs with a dial.

Basic
0
Readonly
50
Disabled
75
Min/Max
10
Step
40
Template
60%
Stroke
40
Size
60
Color
50
Reactive Knob
0
Import via Module

import { Knob } from 'primereact/knob';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/knob/knob.min.js"></script>
 
Getting Started

Knob is used as a controlled input with value and onChange properties.


<Knob value={value} onChange={(e) => setValue(value)} />
 
Minimum and Maximum

Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively.


<Knob value={value} min={0} max={100} onChange={(e) => setValue(value)} />
 
Step

Step factor is 1 by default and can be customized with step option.


<Knob value={value} step={10} onChange={(e) => setValue(value)} />
 
Styling

valueColor defines the value color, rangeColor defines the range background and similarly textColor configures the color of the value text. In addition, strokeWidth is used to determine the width of the stroke of range and value sections.


<Knob value={value} valueColor={"SlateGray"} rangeColor={"MediumTurquoise"} onChange={(e) => setValue(value)} />
 
Size

Default size of the Knob is 100 pixels for width and height, use the size property to customize it per your requirements.


<Knob value={value} size={200} onChange={(e) => setValue(value)} />
 
Properties

Any property as style and class are passed to the main container element. Following are the additional properties to configure the component.

NameTypeDefaultDescription
idstringnullUnique identifier of the element.
valuenumbernullValue of the component.
sizenumber100Size of the component in pixels.
disabledbooleanfalseWhen present, it specifies that the component should be disabled.
readOnlybooleanfalseWhen present, it specifies that the component value cannot be edited.
stepnumbernullStep factor to increment/decrement the value.
minnumber0Mininum boundary value.
maxnumber100Maximum boundary value.
valueColorstringnullBackground of the value.
rangeColornumbernullBackground color of the range.
textColornumbernullColor of the value text.
strokeWidthnumber14Width of the knob stroke.
showValuebooleantrueWhether the show the value inside the knob.
valueTemplatestring{value}Template string of the value.
Events
NameParametersDescription
onChangevalue: New valueCallback to invoke when the value changes.
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-knobContainer element.
p-knob-rangeRange element.
p-knob-valueValue element.
p-knob-textText element.
Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma