diff --git a/.changeset/lazy-crews-cry.md b/.changeset/lazy-crews-cry.md new file mode 100644 index 000000000..1a23297c3 --- /dev/null +++ b/.changeset/lazy-crews-cry.md @@ -0,0 +1,6 @@ +--- +'@lion/checkbox-group': patch +'@lion/radio-group': patch +--- + +Add slot="label" example to docs diff --git a/docs/components/inputs/checkbox-group/features.md b/docs/components/inputs/checkbox-group/features.md index 695c87043..ec1383903 100644 --- a/docs/components/inputs/checkbox-group/features.md +++ b/docs/components/inputs/checkbox-group/features.md @@ -73,6 +73,32 @@ export const disabled = () => html` `; ``` +## Label + +You can use `slot="label"` instead of the `label` attribute for defining more complex labels, such as containing screen reader only text or an anchor. + +```js preview-story +export const label = () => html` + + + + + + + + + + + +`; +``` + ## Help text You can add help text on each checkbox with `help-text` attribute on the ``. @@ -109,7 +135,7 @@ export const event = ({ shadowRoot }) => html` name="scientists[]" label="Favorite scientists" @model-value-changed=${ev => - (shadowRoot.getElementById('selectedDinosaur').innerText = JSON.stringify( + (ev.target.parentElement.querySelector('#selectedDinosaur').innerText = JSON.stringify( ev.target.modelValue, null, 4, @@ -126,17 +152,7 @@ export const event = ({ shadowRoot }) => html` ## Indeterminate -```js preview-story -export const indeterminate = () => html` - - - - - - - -`; -``` +A `checkbox-indeterminate`'s value is neither true nor false, but is instead indeterminate, meaning that its state cannot be determined or stated in pure binary terms, based on it's `checkbox` children. ```js preview-story export const indeterminateSiblings = () => html` @@ -170,6 +186,8 @@ export const indeterminateSiblings = () => html` `; ``` +The `checkbox-indeterminate` can have another `checkbox-indeterminate` as a child. + ```js preview-story export const indeterminateChildren = () => html` diff --git a/docs/components/inputs/radio-group/features.md b/docs/components/inputs/radio-group/features.md index 786743ae4..5aefa79a0 100644 --- a/docs/components/inputs/radio-group/features.md +++ b/docs/components/inputs/radio-group/features.md @@ -66,6 +66,32 @@ export const disabledGroup = () => html` `; ``` +## Label + +You can use `slot="label"` instead of the `label` attribute for defining more complex labels, such as containing screen reader only text or an anchor. + +```js preview-story +export const label = () => html` + + + + + + + + + + + +`; +``` + ## Help text You can add help text on each checkbox with `help-text` attribute on the ``. @@ -102,7 +128,7 @@ export const event = ({ shadowRoot }) => html` name="dinosTwo" label="Favourite dinosaur" @model-value-changed=${ev => - (shadowRoot.getElementById('selectedDinosaur').innerText = ev.target.modelValue)} + (ev.target.parentElement.querySelector('#selectedDinosaur').innerText = ev.target.modelValue)} >