Code Monkey home page Code Monkey logo

Comments (3)

limonte avatar limonte commented on June 7, 2024 2

@KevinBatdorf is totally right. Just use customClass with the desired classes:

Swal.fire({
  title: 'Test modal with input',
  input: 'text',
  icon: 'success',
  showCancelButton: true,
  buttonsStyling: false,
  customClass: {
    popup: 'p-2 rounded-lg bg-gray-600 shadow-lg sm:p-3',
    title: 'ml-3 font-medium text-white truncate',
    input: 'bg-white text-center',
    confirmButton: 'bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded mx-2',
    cancelButton: 'bg-gray-500 hover:bg-gray-400 text-white font-bold py-2 px-4 border-b-4 border-gray-700 hover:gray-blue-500 rounded mx-2',
  }
})

Docs: https://sweetalert2.github.io/#custom-class

from sweetalert2-themes.

KevinBatdorf avatar KevinBatdorf commented on June 7, 2024 1

How would this work with Tailwind being a utility framework with no opinionated style default?

Probably better to just add your Tailwind generated class names directly, which I think can be done via customClass in SweetAlert2?

from sweetalert2-themes.

AbbyJanke avatar AbbyJanke commented on June 7, 2024

@KevinBatdorf I won't lie I've never used themes with SweetAlert2, working on a new project which is my first time really using Tailwind CSS. and while yes there is no opinionated style, thats the important part, being able to add bg-gray-400 for example. little things like that. Maybe customClass would work. Will look into it more I just wanted to throw the idea out there incase anybody else had thoughts/ideas or already did it.

from sweetalert2-themes.

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.