+ }
+ >
+ Radio B - with children
+
+
+
,
document.getElementById('js-example')
);
diff --git a/packages/core/src/components/ChoiceList/Choice.jsx b/packages/core/src/components/ChoiceList/Choice.jsx
index 73c8b0e031..17166e0cbe 100644
--- a/packages/core/src/components/ChoiceList/Choice.jsx
+++ b/packages/core/src/components/ChoiceList/Choice.jsx
@@ -148,7 +148,9 @@ Choice.propTypes = {
*/
checked: PropTypes.bool,
/**
- * Content to be shown when the choice is checked
+ * Content to be shown when the choice is checked. See
+ * **Checked children and the expose within pattern** on
+ * the Guidance tab for detailed instructions.
*/
checkedChildren: PropTypes.node,
/**
diff --git a/packages/core/src/components/ChoiceList/Choice.scss b/packages/core/src/components/ChoiceList/Choice.scss
index 46252d55c7..70d91671ef 100644
--- a/packages/core/src/components/ChoiceList/Choice.scss
+++ b/packages/core/src/components/ChoiceList/Choice.scss
@@ -82,12 +82,26 @@ Markup:
Style guide: components.choice.inversed
*/
+$ds-c-inset-border-width: $spacer-half;
+
// Hide the default browser checkbox/radio button since we'll
// create our own custom version
.ds-c-choice {
left: -999em;
opacity: 0;
position: absolute;
+
+ // Checked children container
+ &__checkedChild {
+ border-left: $ds-c-inset-border-width solid $color-primary;
+ margin-bottom: $spacer-2;
+ margin-left: ($choice-size / 2) - ($ds-c-inset-border-width / 2);
+ padding: $spacer-2;
+
+ &--inverse {
+ border-left-color: $color-white;
+ }
+ }
}
.ds-c-choice + label {
@@ -316,6 +330,19 @@ Style guide: components.choice.react
**[View the "Forms" guidelines for additional guidance and best practices.]({{root}}/guidelines/forms/)**
+## Checked children and the expose within pattern
+
+- The `` component includes a `checkedChildren` prop that can expose hidden text information or form elements. This **expose within** pattern is especially useful if you need to collect data from follow up questions or give just-in-time feedback.
+- Checked children can be exposed by checking the parent checkbox or radio button
+- Checked children will be announced to screen readers when they are exposed. They have been tested with the following devices:
+ - Windows 10 + Internet Explorer 11 + JAWS screen reader
+ - Windows 10 + Chrome + JAWS
+ - Windows 10 + Firefox + NVDA
+ - MacOS Mojave + Safari + VoiceOver
+- The checkedChildren prop should return one or more items wrapped in a `div` with the following className: `ds-c-choice__checkedChild`. This class sets the spacing and border color for the exposed elements.
+- Add the className `ds-c-choice__checkedChild--inverse` to the `div` to show the inverse white border
+- You may need to add the className `ds-u-margin--0` to your child element(s) to avoid extra top margin
+
## Accessibility
- Surround a related set of choices with a `