Giter VIP home page Giter VIP logo

Comments (7)

noook avatar noook commented on September 28, 2024 1

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.

noook avatar noook commented on September 28, 2024 1

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.

MuhammadM1998 avatar MuhammadM1998 commented on September 28, 2024 1

And here I thought it would be simple. Maybe a mismatch isn't a bad idea πŸ˜‚

from ui.

MuhammadM1998 avatar MuhammadM1998 commented on September 28, 2024

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.

maximepvrt avatar maximepvrt commented on September 28, 2024

@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.

MuhammadM1998 avatar MuhammadM1998 commented on September 28, 2024

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.

maximepvrt avatar maximepvrt commented on September 28, 2024

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).

Capture d’écran 2024-05-22 aΜ€ 17 41 49
Capture d’écran 2024-05-22 aΜ€ 17 41 42

from ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.