feat: add data-kumo attributes to component root elements#207
Closed
mattrothenberg wants to merge 5 commits intomainfrom
Closed
feat: add data-kumo attributes to component root elements#207mattrothenberg wants to merge 5 commits intomainfrom
mattrothenberg wants to merge 5 commits intomainfrom
Conversation
commit: |
Contributor
Docs PreviewCommit: |
7e825d8 to
7820ca9
Compare
Add data-kumo attributes to enable targeted CSS resets in consuming
applications that have conflicting global styles (e.g., Stratus).
Components updated:
- Badge, Button, Checkbox, Collapsible, Combobox, Dialog, Dropdown,
Field, Input, Label, Link, MenuBar, Popover, Radio, Select, Switch,
Tabs, Tooltip
Example usage in consuming app:
```css
[data-kumo="button"] { background: revert; }
[data-kumo="field"] label { margin: 0; }
```
Enables targeted CSS resets for tooltip triggers that may be affected by global button styles (e.g., gray backgrounds in Stratus).
- popover-trigger - dialog-trigger - dropdown-trigger Enables targeted CSS resets for all overlay trigger elements.
When asChild or render prop is used, the trigger element is consumer-owned (e.g., a Kumo Button), so we should not stamp our data-kumo attribute on it. This prevents CSS resets from accidentally stripping styles from styled buttons. - tooltip: data-kumo="tooltip-trigger" only when !asChild - popover: data-kumo="popover-trigger" only when !asChild - dialog: data-kumo="dialog-trigger" only when !render - dropdown: data-kumo="dropdown-trigger" only when !effectiveRender
475b1d1 to
77d1c89
Compare
Collaborator
Author
|
Superseded by #214 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
data-kumoattributes to component root elements to enable targeted CSS resets in consuming applications (like Stratus) that have conflicting global styles.Problem
Stratus and other consuming applications have global CSS that pollutes Kumo components - e.g., button backgrounds, SVG fills, input label margins. Base UI provides state attributes (
data-checked,data-disabled, etc.) but no component identification attributes.Solution
Add
data-kumo="component-name"attributes to component root elements, enabling targeted resets:Components Updated (18 total)
data-kumo="badge"data-kumo="button",data-kumo="link-button"data-kumo="checkbox",data-kumo="checkbox-group"data-kumo="collapsible",data-kumo="collapsible-trigger",data-kumo="collapsible-content"data-kumo="combobox",data-kumo="combobox-item"data-kumo="dialog",data-kumo="dialog-title",data-kumo="dialog-description"data-kumo="dropdown",data-kumo="dropdown-item",data-kumo="dropdown-link-item",data-kumo="dropdown-checkbox-item",data-kumo="dropdown-radio-item",data-kumo="dropdown-label",data-kumo="dropdown-separator"data-kumo="field"data-kumo="input"data-kumo="label"data-kumo="link"data-kumo="menubar",data-kumo="menubar-option"data-kumo="popover",data-kumo="popover-title",data-kumo="popover-description"data-kumo="radio",data-kumo="radio-group"data-kumo="select"data-kumo="switch",data-kumo="switch-group"data-kumo="tabs",data-kumo="tabs-list",data-kumo="tabs-tab"data-kumo="tooltip"Skipped
Testing