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

fix: use a rounded corner decoration by default for ShadTabs to match the official shadcn implementation #203

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ class ShadDefaultThemeNoSecondaryBorderVariant extends ShadThemeVariant {
tabForegroundColor: colorScheme.foreground,
tabSelectedForegroundColor: colorScheme.foreground,
tabSelectedShadows: ShadShadows.sm,
tabDecoration: ShadDecoration(
border: ShadBorder.all(radius: radius, width: 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the radius to 4
Screenshot 2024-12-02 at 10 41 38

As you can see in the image above, the default radius used by ui.shadcn.com is 4px.
0.5 rem = 8 px
8px - 4px = 4px

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked the source code and it uses rounded-sm which is 2px.
https://github.com/shadcn-ui/ui/blob/805ed4120a6a8ae6f6e9714cbd776e18eeba92c7/apps/www/registry/default/ui/tabs.tsx#L32C66-L32C76

So the source code and what is rendered on the docs is different.
No idea of what is supposed to be the right value.
Probably 4px is more elegant than just 2px

),
);
}

Expand Down
3 changes: 3 additions & 0 deletions lib/src/theme/themes/default_theme_variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,9 @@ class ShadDefaultThemeVariant extends ShadThemeVariant {
tabForegroundColor: colorScheme.foreground,
tabSelectedForegroundColor: colorScheme.foreground,
tabSelectedShadows: ShadShadows.sm,
tabDecoration: ShadDecoration(
border: ShadBorder.all(radius: radius, width: 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the radius to 4 as mentioned above

),
);
}

Expand Down