marmelab / marmelab/react-admin
Button should have an override to prevent from going to Icon in mobile
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 26.9k
- Forks
- 5.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 19
Description
**Is your feature request related to a problem? Please describe.**
We have what I thought would be a fairly normal scenario where our designs require the actions Buttons to remain full width in mobile and desktop. But when going to mobile they default to an icon button and there is no way to override this.
**Describe the solution you'd like**
A prop that can be passed to an Edit, Save button that simply overrides the isXSmall condition on a button.
**Describe alternatives you've considered**
Having to implement my own Edit or Save buttons and then removing that functionality however this seems wasteful.
**Additional context**
In Button.tsx we could just have an option added such as shrink. Which can default to true.
````
return isXSmall && shrink ? (
label && !disabled ? (
{children}
) : (
{children}
)
) : (
{translatedLabel}
);
````
If you're happy with this then i'd be happy to open a PR. Is there anymore use cases that I'm potentially missing?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Button.tsx at the isXSmall branch that switches between IconButton and StyledButton. Review how Edit and Save buttons pass props, then add the requested override while preserving the current default behavior. Done means callers can keep these buttons full width on mobile without implementing custom buttons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- design, frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100