Skip to content

Button should have an override to prevent from going to Icon in mobile  #8720

Description

@patrickcollings

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 ? (
            <Tooltip title={translatedLabel}>
                <IconButton
                    aria-label={translatedLabel}
                    className={className}
                    color={color}
                    size="large"
                    {...rest}
                    {...linkParams}
                >
                    {children}
                </IconButton>
            </Tooltip>
        ) : (
            <IconButton
                className={className}
                color={color}
                disabled={disabled}
                size="large"
                {...rest}
                {...linkParams}
            >
                {children}
            </IconButton>
        )
    ) : (
        <StyledButton
            className={className}
            color={color}
            size={size}
            aria-label={translatedLabel}
            disabled={disabled}
            startIcon={alignIcon === 'left' && children ? children : undefined}
            endIcon={alignIcon === 'right' && children ? children : undefined}
            {...rest}
            {...linkParams}
        >
            {translatedLabel}
        </StyledButton>
    );

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions