Comments (2)
Hi! Thanks for taking the time!
Currently, we are using css selectors to override some of the styles (which seems a little hacky) and thought it would be helpful we could pass styles using a prop.
I see TreeView doesn't support sx for all the child items. This was partially intentional at the time of building it so that the design does not deviate too much. The use cases however are many and varied now (like NestedListView!)
We want to phase out styling through a prop (sx) over time, so I would recommend using classNames. However, TreeView does not have reliable selectors that you can target yet. Would that be a useful change for you?
from react.
@siddharthkp I think a good solution would be to support custom styling on TreeView
and TreeView.Item
. That could be via the sx
prop or className
prop (or maybe both for this in-between time).
However, TreeView does not have reliable selectors that you can target yet.
I think we should probably avoid getting into the habit of exposing targetable selectors, because it makes things difficult to change. Long term, it will make it harder for PRC to move to CSS Modules because the class names would need to remain static.
If there's specific things we want to support styling internally, I think we should either add props for the required variants, like hideNestingIndicators
, or we should add support for more externally defined classnames rather than defining new internal classnames. This could look like a new nestingIndicatorClassName
prop or maybe even a whole new standard PRC pattern where we have an internalClassNames
prop that accepts an object: <TreeView.Item internalClassNames={{nestingIndicator: styles.hidden}} />
Or, one more option might be to set data-
attributes for selection instead of classes, which preserves encapsulation. But I think we'd want to document those and personally I'd prefer some props-based approach that can be typechecked vs an approach that requires more complex CSS selectors.
from react.
Related Issues (20)
- Setting `required` to `input` element within `TextInput` HOT 2
- TypeError: CSS.supports is not a function when running Jest tests HOT 2
- Active `NavList.Item` is incorrectly missing bold styling HOT 4
- The theme object inflates bundle size. HOT 1
- Release Tracking
- The `useAnchoredPosition` hook returns generic refs for Element, which always requires a type assertion by the user
- TreeView: Remove aria-describedby when leading and trailing visuals do not exist HOT 2
- Does the Primer Design System have card components or similar card-like components? HOT 1
- Release Tracking HOT 1
- TexInput `onClick` focus behavior broken with `type=date` on Safari
- `Dialog` should allow wrapping content, header, and footer (for example in `Suspense` or some context) HOT 1
- Utils should be exported
- Tests: Remove redundant ThemeProvider from tests
- `DialogV2` has incorrect names for width values HOT 1
- Enhancement: Add support for flush action lists HOT 2
- Update docs for `Button` to not consider `count` as required HOT 1
- Release Tracking
- Using `TooltipV2` always sets aria associations on first child element HOT 9
- [Tests] Ensure that axe calls are made on open state of the component HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.