Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(CheckboxInput): expose theme targets for the control and the marks (#5426)

freddymeta7b60efafa733
diff --git a/.changeset/checkbox-theme-targets.md b/.changeset/checkbox-theme-targets.md
new file mode 100644
index 0000000000..1095bb14c4
--- /dev/null
+++ b/.changeset/checkbox-theme-targets.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[feat] The checkbox indicator now exposes stable theme targets for its two marks — `astryx-checkbox-indicator-check` (the checkmark) and `astryx-checkbox-indicator-dash` (the indeterminate bar) — mirroring the existing `astryx-radio-indicator-dot`. Both reflect `size`. A theme restyling the mark itself (stroke weight, colour, the dash's proportions) previously had to reach it with `.astryx-checkbox-indicator > svg` and `> span`, which are element-and-order selectors that break silently on any restructure. Purely additive; no visual change.
+
+@freddymeta
diff --git a/packages/core/src/Indicator/CheckboxIndicator.tsx b/packages/core/src/Indicator/CheckboxIndicator.tsx
index e908c1af47..494908cf4b 100644
--- a/packages/core/src/Indicator/CheckboxIndicator.tsx
+++ b/packages/core/src/Indicator/CheckboxIndicator.tsx
@@ -227,10 +227,13 @@ export function CheckboxIndicator({
<>
<svg
viewBox="0 0 10 10"
- {...stylex.props(
- styles.checkmark,
- checkmarkSizeStyles[size],
- isChecked && styles.checkmarkVisible,
+ {...mergeProps(
+ themeProps('checkbox-indicator-check', {size}),
+ stylex.props(
+ styles.checkmark,
+ checkmarkSizeStyles[size],
+ isChecked && styles.checkmarkVisible,
+ ),
)}>
<path
d="M8.5 2.5L4 7.5L1.5 5"
@@ -242,10 +245,13 @@ export function CheckboxIndicator({
/>
</svg>
<span
- {...stylex.props(
- styles.indeterminateMark,
- indeterminateSizeStyles[size],
- isIndeterminate && styles.indeterminateMarkVisible,
+ {...mergeProps(
+ themeProps('checkbox-indicator-dash', {size}),
+ stylex.props(
+ styles.indeterminateMark,
+ indeterminateSizeStyles[size],
+ isIndeterminate && styles.indeterminateMarkVisible,
+ ),
)}
/>
</>
diff --git a/packages/core/src/Indicator/Indicator.doc.mjs b/packages/core/src/Indicator/Indicator.doc.mjs
index e4e9a4c6ca..79c31e6453 100644
--- a/packages/core/src/Indicator/Indicator.doc.mjs
+++ b/packages/core/src/Indicator/Indicator.doc.mjs
@@ -132,6 +132,8 @@ export const docs = {
visualProps: ['size'],
states: ['checked', 'disabled'],
},
+ {className: 'astryx-checkbox-indicator-check', visualProps: ['size']},
+ {className: 'astryx-checkbox-indicator-dash', visualProps: ['size']},
{
className: 'astryx-radio-indicator',
visualProps: ['size'],