Search code examples
widthcustomizationtailwind-css

Tailwindcss customize width with name


I want to add custom items in tailwindcss width. I found out that you have to use spacing. In the colors customisation you can use multiple objects with names. Is it possible to do this with spacing as well? When I try to do it, nothing happens in the browser...

spacing: {
        // the commented lines work as excepted
        // 'cta-slogan': '23.813rem',
        // 'services-item': '28.5rem',

        // these don't work..
        cta: { slogan: '23.813rem' },
        services: { item: '28.5rem' },
      },

Solution

  • As of now Tailwind isn't supporting Nested object syntax for spacing. Currently, you will have to stick with 'cta-slogan': '23.813rem'.

    If in future upgrades this is supported, I will keep you posted via this thread. Cheers!