Better way to support density switch on breakpoints #3303
Labels
community
For issues that have been raised by folks outside the core Salt team
component: salt provider
status: awaiting triage
Automatically added to new issues. Should be removed once they have been triaged.
type: enhancement 💡
New feature or request
Area
UI Components
The problem
Some site needs to switch density depending on breakpoints, Salt website does this as well. There isn't a straightforward way to implement this at the moment, where
density
needs to be provided as a prop toSaltProvider
but breakpoint can only be accessed inside the provider (e.g., via nested component). It creates unnecessary nesting to implement this feature.The solution
Add callback to
SaltProvider
/ itsuseDensity
hook to update density, similar to POC for mode in #3237.Alternatives and examples
Not so ideal implementation with nested component just for a callback: https://stackblitz.com/edit/salt-template-56hpdn?file=App.tsx
Are you a JPMorgan Chase & Co. employee?
The text was updated successfully, but these errors were encountered: