MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / Label

Function Label

src/Label.js:53–118  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

51};
52
53function Label(props) {
54 const {
55 className,
56 cssModule,
57 hidden,
58 widths = colWidths,
59 tag: Tag = 'label',
60 check,
61 size,
62 for: htmlFor,
63 ...attributes
64 } = props;
65
66 const colClasses = [];
67
68 widths.forEach((colWidth, i) => {
69 let columnProp = props[colWidth];
70
71 delete attributes[colWidth];
72
73 if (!columnProp && columnProp !== '') {
74 return;
75 }
76
77 const isXs = !i;
78 let colClass;
79
80 if (isObject(columnProp)) {
81 const colSizeInterfix = isXs ? '-' : `-${colWidth}-`;
82 colClass = getColumnSizeClass(isXs, colWidth, columnProp.size);
83
84 colClasses.push(
85 mapToCssModules(
86 classNames({
87 [colClass]: columnProp.size || columnProp.size === '',
88 [`order${colSizeInterfix}${columnProp.order}`]:
89 columnProp.order || columnProp.order === 0,
90 [`offset${colSizeInterfix}${columnProp.offset}`]:
91 columnProp.offset || columnProp.offset === 0,
92 }),
93 ),
94 cssModule,
95 );
96 } else {
97 colClass = getColumnSizeClass(isXs, colWidth, columnProp);
98 colClasses.push(colClass);
99 }
100 });
101
102 const colFormLabel = size || colClasses.length;
103 const formLabel = !(check || colFormLabel);
104
105 const classes = mapToCssModules(
106 classNames(
107 className,
108 hidden ? 'visually-hidden' : false,
109 check ? 'form-check-label' : false,
110 size ? `col-form-label-${size}` : false,

Callers

nothing calls this directly

Calls 3

isObjectFunction · 0.90
mapToCssModulesFunction · 0.90
getColumnSizeClassFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…