Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button (Tailwind): Theming Documentation is missing attributes for button without label #5526

Closed
sdwillbrand opened this issue Dec 5, 2023 · 6 comments
Assignees
Labels
Component: Documentation Issue or pull request is related to Documentation
Milestone

Comments

@sdwillbrand
Copy link
Contributor

sdwillbrand commented Dec 5, 2023

Describe the bug

The documentation describes a different button as used in the library. By default a labeless button hides the label span. But when importing the theming from the documentation, this feature is missing and the label span is rendered. Resulting in an uncentered icon in the button.

Reproducer

https://codesandbox.io/p/sandbox/primereact-bug-labeless-button-no-centered-icon-zjyc47

PrimeReact version

10.2.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to PrimeReact Documentation
  2. Go to Button > Theming
  3. Inspect Tailwind theming

Expected behavior

Centered icon in labeless default button.

@sdwillbrand sdwillbrand added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 5, 2023
@melloware melloware added Status: Needs Reproducer Issue needs a runnable reproducer and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 5, 2023
Copy link

github-actions bot commented Dec 5, 2023

Please fork the CodeSandbox project or Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

@sdwillbrand
Copy link
Contributor Author

Codesandbox example updated in the issue. We replaced the default styling of the button with the theming presented in the documentation. If you inspect the button you can see a gap next to the icon. We suspect it is caused by the label tag which it still not invisible. The documentation of the button theming might be insufficient.

@sdwillbrand
Copy link
Contributor Author

sdwillbrand commented Dec 5, 2023

{ 'w-0': !props.label }

This is our current workaround to hide the label when no text is used.

@melloware
Copy link
Member

Where did you put { 'w-0': !props.label } can you update your sandbox? Also shouldn't it be hidden instead of width-0 ?

@melloware melloware added Component: Tailwind Tailwind specific issue and removed Status: Needs Reproducer Issue needs a runnable reproducer labels Dec 5, 2023
@sdwillbrand
Copy link
Contributor Author

I've updated the sandbox. You can find the adjustments where the comment "HERE" is. By default the tailwind theme has the additional classes for the button "invisible" and "w-0" where "w-0" is the crucial class for hiding the label. "invisible" only hides the element but it still takes up space in the DOM. It could also be "hidden".

@melloware melloware self-assigned this Dec 5, 2023
@melloware melloware added this to the 10.2.2 milestone Dec 5, 2023
@melloware
Copy link
Member

Got it the code already has this { 'invisible w-0': props.label == null }

label: ({ props }) => ({
            className: classNames(
                'flex-1',
                'duration-200',
                'font-bold',
                {
                    'hover:underline': props.link
                },
                { 'invisible w-0': props.label == null }
            )
        })

@melloware melloware added Component: Documentation Issue or pull request is related to Documentation and removed Component: Tailwind Tailwind specific issue labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Issue or pull request is related to Documentation
Projects
None yet
Development

No branches or pull requests

2 participants