If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
Readonly
propsStatic
Optional
contextIf set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Emitted when a value change is committed on a thumb drag end or keyboard interaction.
Emitted when a value change is committed on a thumb drag end or keyboard interaction.
Disables the UI interactions of the slider.
Marks the slider track as discrete so it displays the steps.
If the step
is 0, the slider will remain continuos even if discreteTrack
is true
.
Hides the primary tick labels.
Hides the secondary tick labels.
Hides the thumb tooltip.
Emitted when a value is changed via thumb drag or keyboard interaction.
Emitted when a value is changed via thumb drag or keyboard interaction.
Control the validity of the control.
The locale used to format the thumb and tick label values in the slider.
The lower bound of the slider value. If not set, the min
value is applied.
The maximum value of the slider scale. Defaults to 100.
If max
is less than min
the call is a no-op.
If labels
are provided (projected), then max
is always set to
the number of labels.
If upperBound
ends up being greater than than the current max
value,
it is automatically assigned the new max
value.
The minimum value of the slider scale. Defaults to 0.
If min
is greater than max
the call is a no-op.
If labels
are provided (projected), then min
is always set to 0.
If lowerBound
ends up being less than than the current min
value,
it is automatically assigned the new min
value.
The name attribute of the control.
The number of primary ticks. It defaults to 0 which means no primary ticks are displayed.
The number of secondary ticks. It defaults to 0 which means no secondary ticks are displayed.
Specifies the granularity that the value must adhere to.
If set to 0 no stepping is implied and any value in the range is allowed.
If labels
are provided (projected) then the step is always assumed to be 1 since it is a discrete slider.
The degrees for the rotation of the tick labels. Defaults to 0.
Changes the orientation of the ticks.
The upper bound of the slider value. If not set, the max
value is applied.
The current value of the component.
String format used for the thumb and tick label values in the slider.
Number format options used for the thumb and tick label values in the slider.
Optional
UNSAFE_Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use componentDidMount or the constructor instead
Optional
UNSAFE_Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use static getDerivedStateFromProps instead
Optional
UNSAFE_Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use getSnapshotBeforeUpdate instead
Optional
componentOptional
componentCalled immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Optional
componentCalled immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use componentDidMount or the constructor instead; will stop working in React 17
Optional
componentCalled when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use static getDerivedStateFromProps instead; will stop working in React 17
Optional
componentOptional
componentCalled immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
Optional
getRuns before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Decrements the value of the slider by stepDecrement * step
, where stepDecrement
defaults to 1.
stepDecrement Optional step decrement. If no parameter is passed, it defaults to 1.
Increments the value of the slider by stepIncrement * step
, where stepIncrement
defaults to 1.
stepIncrement Optional step increment. If no parameter is passed, it defaults to 1.
Static
_create
A slider component used to select numeric value within a range.