Styling #919
Replies: 2 comments 1 reply
-
Writing the Slider component, I realized that just adding the attribute to the parent ( And so were the component styles: [data-store-slider] {
}
[data-store-slider-range] {
}
[data-store-slider-track] {
}
[data-store-slider-thumb='(left|right)'] {
}
[data-store-slider-values] {
}
[data-store-slider-value='(min|max)'] {
} |
Beta Was this translation helpful? Give feedback.
-
I have a proposal, about how to style the components and use the data-attributes inside components. An example: // IconButton.tsx component file
interface ButtonProps extends HTMLAttributes<HTMLButtonElement> { ... }
interface Props extends ButtonProps {
...
icon: ReactNode
...
}
const IconButton = forwardRef(function IconButton({ className, icon, ...props }, ref) {
return (<Button data-store-icon-button className={className} {...props}>{icon}</Button>)
}) The component story // IconButton.stories.tsx
const IconButtonTemplate = (...) => {
return <IconButton className="customClassName" ... />
}
... The CSS [data-store-button] { ... } // for the Button Component
[data-disabled] { ... } // for the disabled state
[data-store-icon-button] { ... } // for the IconButton Component
.customClassName[data-store-icon-button] { ... } // For the specific icon button case |
Beta Was this translation helpful? Give feedback.
-
Guys, seeing that we are having several conflicts when styling a component, I believe that we should have this discussion to standardize how and when the styling should be done.
Inspired by the Reach UI, we decided that we would use
data-attribute
for styling our components. But there are use cases where we don't know how to use those attributes. I would like your opinion, along with examples of how we should do the styling usingdata-attribute
in order to establish a standard for our components and that meets the maximum of our use cases.Beta Was this translation helpful? Give feedback.
All reactions