GithubHelp home page GithubHelp logo

Comments (2)

siddharthkp avatar siddharthkp commented on May 1, 2024

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.

iansan5653 avatar iansan5653 commented on May 1, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.