Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ export const LightMode: Story = {
</DataAttrWrapper>
</>
))}
<Checkbox defaultSelected isReadOnly isRequired>
<Checkbox defaultSelected isReadOnly>
Readonly
</Checkbox>
<Checkbox defaultSelected isRequired>
Is Required
</Checkbox>
</StoryGrid>
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ const _Checkbox = (props: CheckboxProps, ref: HeadlessCheckboxRef) => {
inlineLabelStyles["inline-label"],
)}
>
{Boolean(children) && <Text>{children}</Text>}
{Boolean(children) && (
<>
<Text>{children}</Text>
{Boolean(props.isRequired) && (
<Text
color="negative"
data-inline-label-necessity-indicator-icon=""
>
*
</Text>
)}
</>
)}
</HeadlessCheckbox>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
--checkbox-border-color: var(--color-bd-neutral-hover);
}

& [data-inline-label-necessity-indicator-icon] {
color: var(--color-fg-negative);
margin-inline-start: var(--inner-spacing-1);
}

/**
* ----------------------------------------------------------------------------
* LABEL POSITION
Expand Down Expand Up @@ -86,10 +91,10 @@
}

/**
* ----------------------------------------------------------------------------
* ERROR ( INVALID )
*-----------------------------------------------------------------------------
*/
* ----------------------------------------------------------------------------
* ERROR ( INVALID )
*-----------------------------------------------------------------------------
*/
&[data-invalid] [data-icon] {
--checkbox-border-color: var(--color-bd-negative);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,11 @@ export const CustomIcon: Story = {
</Flex>
),
};

export const IsRequired: Story = {
render: () => (
<Flex direction="column" gap="1rem" wrap="wrap">
<Checkbox isRequired>Required</Checkbox>
</Flex>
),
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
& [data-field-necessity-indicator-icon] {
color: var(--color-fg-negative);
margin-left: var(--inner-spacing-1);
margin-inline-start: var(--inner-spacing-1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny refactor.

}

/**
Expand Down