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

btn-icon padding #1184

Closed
SergkeiM opened this issue Mar 19, 2023 · 5 comments · Fixed by #1236
Closed

btn-icon padding #1184

SergkeiM opened this issue Mar 19, 2023 · 5 comments · Fixed by #1236
Labels
bug Something isn't working

Comments

@SergkeiM
Copy link

SergkeiM commented Mar 19, 2023

Current Behavior

Currently when using .btn-icon

<button class="btn-icon">
	<Icon icon={mdiMenu}/>
</button>

Has width and padding:

padding-left: 1.25rem;
padding-right: 1.25rem;
width: 43px;

Above leaves 0 space for indside content so the icon is not visible

Steps To Reproduce

As said above

Anything else?

I suggest removing padding .btn-icon as there is already width and flex/text alignment in place. ( So is not BC)

@SergkeiM SergkeiM added the bug Something isn't working label Mar 19, 2023
@Sarenor
Copy link
Contributor

Sarenor commented Mar 20, 2023

As you can see in the docs https://www.skeleton.dev/elements/buttons
image
Icon buttons work.

Could you share a bit more of your code like the content of the Icon Component?

@bennymi
Copy link
Contributor

bennymi commented Mar 20, 2023

Did you try giving your icon a size? If you're using iconify icons it might be because of that.

<button class="btn-icon">
	<Icon icon={mdiMenu} class="text-2xl" />
</button>

@endigo9740 endigo9740 added the wontfix This will not be worked on label Mar 24, 2023
@endigo9740
Copy link
Contributor

Closing due to inactivity. Feel free to share a specific code example if Benny's tip above didn't resolve your issue.

@Sarenor
Copy link
Contributor

Sarenor commented Mar 26, 2023

	<button class="btn-icon variant-filled" type="button">
		<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 text-2xl">
			<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10">
			</path>
		</svg>
	</button>

Thanks to ak4zh on Discord we finally have a reproduction that works and shows the problem, even with Benny's text-2xl suggestion!

The problem stems from using SVGs that are automatically scaled to fit and the paddings applied in button-base-style shrinking that fit to about 3 px wide.

@Sarenor Sarenor reopened this Mar 26, 2023
@Sarenor
Copy link
Contributor

Sarenor commented Mar 26, 2023

@SergkeiM I assume your Icon-Component directly renders an SVG as well. Until we figured out a solution, you can wrap your Icon in a <span> with explicitly set dimensions like so:

<button class="btn-icon">
  <span class="w-6 h-6">
    <Icon icon={mdiMenu}/>
  </span>
</button>

@endigo9740 endigo9740 removed the wontfix This will not be worked on label Mar 30, 2023
@endigo9740 endigo9740 linked a pull request Mar 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants