Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add <sd-checkbox /> and <sd-checkboxgroup /> #71

Merged
merged 10 commits into from
Nov 18, 2024
Merged

Conversation

GeekyEggo
Copy link
Member

  • Adds <sd-checkbox />.
  • Adds <sd-checkboxgroup />.
  • Fixes incorrect activation space around <sd-switch />.
  • Updates <sd-switch /> to be read from textContent, rather than label.
  • Updates <sd-switch /> styles to align with <sd-checkbox />.
  • Removes <sd-label /> from <sd-switch />.

* @inheritdoc
*/
public override render(): TemplateResult {
return html`
Copy link
Member

Choose a reason for hiding this comment

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

It looks like in a <sd-radiogroup> the label or the slot content from the inner <sd-option> is displayed, but in a <sd-checkboxgroup> only slot content from the inner <sd-option> is displayed. I think we should also be looking for the label property of the <sd-option> here?

<sd-field label="Radio Group">
	<sd-radiogroup setting="radioSetting">
		<sd-option label="Value 1" value="1">Other Value</sd-option>
		<sd-option label="Value 2" value="2"></sd-option>
		<sd-option label="Value 3" value="3"></sd-option>
	</sd-radiogroup>
</sd-field>
<sd-field label="Checkbox Group">
	<sd-checkboxgroup setting="checkboxGroupSetting">
		<sd-option label="Value 1" value="1">Other Value</sd-option>
		<sd-option label="Value 2" value="2"></sd-option>
		<sd-option label="Value 3" value="3"></sd-option>
	</sd-checkboxgroup>
</sd-field>

CleanShot 2024-11-06 at 16 02 09@2x

Copy link
Member Author

@GeekyEggo GeekyEggo Nov 7, 2024

Choose a reason for hiding this comment

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

Great call out; I've updated the following option-type elements to utilize their textContent as the label:

  • <sd-checkbox />
  • <sd-option />
  • <sd-radio />
  • <sd-switch />

This allows for the elements to be constructed in a similar manor to <select />, for example

<sd-switch setting="isOn">On / Off</sd-switch>

Or in the context of a group:

<sd-checkboxgroup setting="options">
    <sd-option value="1">One</sd-option>
    <sd-option value="2">Two</sd-option>
</sd-checkboxgroup>

@GeekyEggo GeekyEggo merged commit 14008df into features/ui Nov 18, 2024
2 checks passed
@GeekyEggo GeekyEggo deleted the checkbox branch November 18, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants