Skip to content

Commit 5080a30

Browse files
committed
add js docs to the slider components
1 parent 699e51a commit 5080a30

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/chakra-ui/src/components/ui/slider.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ export interface SliderProps extends ChakraSlider.RootProps {
77
showValue?: boolean;
88
}
99

10+
/**
11+
* Slider component that allows users to select a value from a range.
12+
*
13+
* @param {SliderProps} props - The properties for the slider component.
14+
* @param {Array<number | { value: number; label: React.ReactNode }>} [props.marks] - The marks to display on the slider.
15+
* @param {React.ReactNode} [props.label] - The label for the slider.
16+
* @param {boolean} [props.showValue] - Whether to show the current value of the slider.
17+
* @returns {JSX.Element} The rendered slider component.
18+
*/
1019
export const Slider = React.forwardRef<HTMLDivElement, SliderProps>(function Slider(props, ref) {
1120
const { marks: marksProp, label, showValue, ...rest } = props;
1221
const value = props.defaultValue ?? props.value;
@@ -40,6 +49,13 @@ export const Slider = React.forwardRef<HTMLDivElement, SliderProps>(function Sli
4049
);
4150
});
4251

52+
/**
53+
* SliderThumbs component that renders the thumbs for the slider.
54+
*
55+
* @param {Object} props - The properties for the slider thumbs component.
56+
* @param {number[]} [props.value] - The values for the thumbs.
57+
* @returns {JSX.Element} The rendered slider thumbs component.
58+
*/
4359
function SliderThumbs(props: { value?: number[] }) {
4460
const { value } = props;
4561
return (
@@ -57,6 +73,13 @@ interface SliderMarksProps {
5773
marks?: Array<number | { value: number; label: React.ReactNode }>;
5874
}
5975

76+
/**
77+
* SliderMarks component that renders the marks for the slider.
78+
*
79+
* @param {SliderMarksProps} props - The properties for the slider marks component.
80+
* @param {Array<number | { value: number; label: React.ReactNode }>} [props.marks] - The marks to display on the slider.
81+
* @returns {JSX.Element | null} The rendered slider marks component or null if no marks are provided.
82+
*/
6083
const SliderMarks = React.forwardRef<HTMLDivElement, SliderMarksProps>(function SliderMarks(props, ref) {
6184
const { marks } = props;
6285
if (!marks?.length) {

0 commit comments

Comments
 (0)