MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / CarouselIndicators

Function CarouselIndicators

src/CarouselIndicators.js:6–45  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

4import { mapToCssModules } from './utils';
5
6function CarouselIndicators(props) {
7 const {
8 items,
9 activeIndex,
10 cssModule,
11 onClickHandler,
12 className,
13 ...attributes
14 } = props;
15
16 const listClasses = mapToCssModules(
17 classNames(className, 'carousel-indicators'),
18 cssModule,
19 );
20 const indicators = items.map((item, idx) => {
21 const indicatorClasses = mapToCssModules(
22 classNames({ active: activeIndex === idx }),
23 cssModule,
24 );
25 return (
26 <button
27 aria-label={item.caption}
28 data-bs-target
29 type="button"
30 key={`${item.key || Object.values(item).join('')}`}
31 onClick={(e) => {
32 e.preventDefault();
33 onClickHandler(idx);
34 }}
35 className={indicatorClasses}
36 />
37 );
38 });
39
40 return (
41 <div className={listClasses} {...attributes}>
42 {indicators}
43 </div>
44 );
45}
46
47CarouselIndicators.propTypes = {
48 /** The current active index */

Callers

nothing calls this directly

Calls 1

mapToCssModulesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…