Comments (7)
I think this falls out of the scope of Nuxt UI. However, I can suggest using Vueuse's useElementSize
to get the size of an element (say, a container) or directly the responsive breakpoint as you mentioned it using Vueuse's useBreakpoints
from ui.
There are actually ... many. π
<UButton>
's config
{
wrapper: {
horizontal: 'inline-flex -space-x-px',
vertical: 'inline-flex flex-col -space-y-px',
},
rounded: 'rounded-md',
shadow: 'shadow-sm',
orientation: {
'rounded-none': {
horizontal: {
start: 'rounded-s-none',
end: 'rounded-e-none',
},
vertical: {
start: 'rounded-t-none',
end: 'rounded-b-none',
},
},
'rounded-sm': {
horizontal: {
start: 'rounded-s-sm',
end: 'rounded-e-sm',
},
vertical: {
start: 'rounded-t-sm',
end: 'rounded-b-sm',
},
},
rounded: {
horizontal: {
start: 'rounded-s',
end: 'rounded-e',
},
vertical: {
start: 'rounded-t',
end: 'rounded-b',
},
},
'rounded-md': {
horizontal: {
start: 'rounded-s-md',
end: 'rounded-e-md',
},
vertical: {
start: 'rounded-t-md',
end: 'rounded-b-md',
},
},
'rounded-lg': {
horizontal: {
start: 'rounded-s-lg',
end: 'rounded-e-lg',
},
vertical: {
start: 'rounded-t-lg',
end: 'rounded-b-lg',
},
},
'rounded-xl': {
horizontal: {
start: 'rounded-s-xl',
end: 'rounded-e-xl',
},
vertical: {
start: 'rounded-t-xl',
end: 'rounded-b-xl',
},
},
'rounded-2xl': {
horizontal: {
start: 'rounded-s-2xl',
end: 'rounded-e-2xl',
},
vertical: {
start: 'rounded-t-2xl',
end: 'rounded-b-2xl',
},
},
'rounded-3xl': {
horizontal: {
start: 'rounded-s-3xl',
end: 'rounded-e-3xl',
},
vertical: {
start: 'rounded-t-3xl',
end: 'rounded-b-3xl',
},
},
'rounded-full': {
horizontal: {
start: 'rounded-s-full',
end: 'rounded-e-full',
},
vertical: {
start: 'rounded-t-full',
end: 'rounded-b-full',
},
},
},
}
@MuhammadM1998 That's right about hydration mismatch, I haven't thought of that
from ui.
And here I thought it would be simple. Maybe a mismatch isn't a bad idea π
from ui.
Not related to your request but the code you're using would produce a hydration mismatch if you're using SSR. I'd suggest passing tailwind breakpoints to ButtonGroup's ui
prop instead. It's monkey patching but wouldn't produce mismatches if that's what you want.
<!-- orientation="vertical" has `flex-col` by default -->
<UButtonGroup :ui={ wrapper: { vertical: 'sm:flex-row' }} orientation="vertical">
...
</UButtonGroup>
from ui.
@MuhammadM1998 It's important to note that simply changing sm:flex-row
to achieve a vertical or horizontal layout for the component is not sufficient. There are other classes that also need to be modified to ensure the component functions correctly in both orientations.
But I agree that handling this only with Tailwind class beakpoints and not javascript would be better
from ui.
I didn't try it before but I think you're right you probably will have to tweak other classes too. I don't think they would be many but It's a hassle indeed
from ui.
The class management for the button group has been rewritten for version 3 (https://github.com/benjamincanac/ui3/blob/dev/src/theme/button-group.ts), and it might be simpler to add it in this version. Additionally, we need orientation management to correct the button group design on the mobile version of the site scripts.nuxt.com (https://github.com/nuxt/scripts/blob/main/docs/pages/index.vue#L229).
from ui.
Related Issues (20)
- UToggle is not getting rerendered when v-model is getting from pinia store
- Loading property for UDropdown Items HOT 1
- Breadcrumb: use custom action instead of link HOT 3
- Is it possible to use contextMenu on a Table? HOT 1
- Nested attributes in objects HOT 5
- Form Input attrs HOT 2
- Button Gray Outline HOT 1
- Hide item in dropdown HOT 1
- Feature Request: Allow min-page Property in Pagination Component
- UInput (file) HTML attribute: accept HOT 2
- After installing Nuxt UI, the Nuxt reload speed drops sharply with each change, and each change takes an average of 30 seconds. HOT 17
- Can't properly change 'primary' color in app.config.ts HOT 1
- Popover giving hydration errors with SSR HOT 4
- Carousel with autoplay and without snap, it's possible? HOT 2
- Skeleton should use span instead of div HOT 3
- [Feature] Make Nuxt UI easy to integrate with Storybook HOT 1
- How validation hides errors for not yet used fields HOT 1
- Form `setErrors` clobbers existing errors
- How can I access the items property in a dropdown component? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui.