Skip to content

Count Indicator

Count Indicator shows progress in a sequence (for example, carousel items) with optional helper text, dots, and previous/next buttons.

Use it when users move step by step through a sequence with a known total. For large totals, the component automatically condenses the dots (based on maxDots) while still reflecting the full count.

PropTypeDescriptionRequired
totalnumberTotal number of items.
indexnumberZero-based current item index.
onPrev() => voidPrevious action callback.
onNext() => voidNext action callback.
wrapbooleanLoops navigation at boundaries.
showHelperbooleanShow X of Y helper text. Default true.
showButtonsbooleanShow previous/next buttons. Default true.
showDotsbooleanShow dots indicator. Default true.
maxDotsnumberMaximum number of rendered dots. Default 10.
semanticDotsbooleanUse 1:1 semantic dots when total <= maxDots. Default true.
ariaLabelstringLabel for the root group.
ariaLabelDotsstringLabel for dots group.
prevAriaLabelstringPrevious button aria-label.
nextAriaLabelstringNext button aria-label.
helperOfLabelstringTranslation for of in helper text.
classNamestringExtra class name for root element.
import { useState } from 'react';
import { CountIndicator } from '@tmedxp/react-components';
const CountIndicatorDefaultExample = () => {
const total = 10;
const [index, setIndex] = useState(0);
return (
<CountIndicator
total={total}
index={index}
ariaLabel="count indicator"
ariaLabelDots="progress"
prevAriaLabel="previous"
nextAriaLabel="next"
helperOfLabel="of"
onPrev={() => setIndex((i) => Math.max(0, i - 1))}
onNext={() => setIndex((i) => Math.min(total - 1, i + 1))}
/>
);
};
export { CountIndicatorDefaultExample };
import { CountIndicator } from '@tmedxp/react-components';
const CountIndicatorSimpleExample = () => {
return (
<CountIndicator
total={42}
index={5}
onPrev={() => {}}
onNext={() => {}}
showButtons={false}
maxDots={5}
ariaLabel="count indicator"
ariaLabelDots="progress"
prevAriaLabel="previous"
nextAriaLabel="next"
helperOfLabel="of"
/>
);
};
export { CountIndicatorSimpleExample };