Skip to content

Commit 2646c12

Browse files
smocklejoshblack
andauthored
feat: Support className prop in FormControl.Caption component (#5726)
Co-authored-by: Josh Black <[email protected]>
1 parent 7849c95 commit 2646c12

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/pink-hotels-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
feat: Support `className` prop in `FormControl.Caption` component

packages/react/src/FormControl/FormControlCaption.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ import {toggleStyledComponent} from '../internal/utils/toggleStyledComponent'
1313
type FormControlCaptionProps = React.PropsWithChildren<
1414
{
1515
id?: string
16+
className?: string
1617
} & SxProp
1718
>
1819

19-
function FormControlCaption({id, children, sx}: FormControlCaptionProps) {
20+
function FormControlCaption({id, children, sx, className}: FormControlCaptionProps) {
2021
const enabled = useFeatureFlag(cssModulesFlag)
2122
const {captionId, disabled} = useFormControlContext()
2223
return (
2324
<StyledCaption
2425
id={id ?? captionId}
25-
className={clsx({
26+
className={clsx(className, {
2627
[classes.Caption]: enabled,
2728
})}
2829
data-control-disabled={disabled ? '' : undefined}

0 commit comments

Comments
 (0)