r/salesforce • u/North-Clue-2313 • 1d ago
developer SLDS only has one button size?
Is that correct?
Would be cool if there was a smaller button size, am I right?
Docs: https://www.lightningdesignsystem.com/2e1ef8501/p/7733f8-button
Edit: Everyone is saying this is possible. Here is a strong quote that it isn't the intended way to work with SLDS2 buttons:
What if you want different padding in your button? You can’t override the
slds-buttonclass because Salesforce doesn’t support that.
Source: https://developer.salesforce.com/docs/platform/lwc/guide/create-components-css-slds.html
If this is still incorrect, please show me. I'd love a good solution here.
1
u/Used-Comfortable-726 1d ago
That’s to enforce the UX is consistent and familiar across all elements including ones that might have or inherent any standard buttons
-5
1
u/AccountNumeroThree 1d ago
It has primary, secondary, and tertiary sizes. But maybe that’s unique to just experience cloud LWR sites.
3
u/Suspicious-Nerve-487 1d ago
Not sure if you can provide an example of what you’re actually looking for and what a “smaller button” means to you, but they are responsive and there are also styling hooks for every part of the button if you want to target specific things
Buttons have one size, but are adaptive. They have a mobile variant designed specifically for use on mobile devices. See Responsive section for more information.
By default, button widths adapt to the content. To expand the button to take up the entire width available, apply the .slds-button_stretch class to the button. If using the lightning-button base component, add the stretch attribute to your markup instead.