Coder Social home page Coder Social logo

Add more cusomization about modali HOT 1 CLOSED

upmostly avatar upmostly commented on September 28, 2024 1
Add more cusomization

from modali.

Comments (1)

jcrowson avatar jcrowson commented on September 28, 2024

@kevinduffey Let me just take a quick second to thank you for taking the time to write this feedback, seriously 🙏. I built Modali to make developer's lives easier when implementing modals, and it's feedback like this that will help me reach that goal.

Now that's out of the way, let's discuss your feedback.

I really like the idea of being able to customize the modal easily, probably through the options. As you said, the three areas are:

  • Title
  • Body
  • Footer (namely, buttons)

I've been thinking about this a lot, and the best way to illustrate what's in my head is to give you a code snippet of where I think I want to go when providing an interface for customizing Modali.

Take the hypothetical example below of a modal confirmation when deleting a user:

import Modali, { useModali } from 'modali';

const [exampleModal, toggleExampleModal] = useModali({
  title: 'Delete User',
  message: 'Are you sure you want to delete this user?',
  buttons: [
    <ModaliButton
      label="Delete"
      isStyleDestructive
      onClick={handleDeleteUser}
    />,
    <ModaliButton
      label="Cancel"
      isStyleCancel
      onClick={toggleExampleModal}
    />
  ],
  animated: true,
});

<Modali.Button /> would be a React button component that Modali provides out of the box, with its own styles (e.g. isStyleCancel, isStyleDestructive, etc).

I'd like to tackle customization in two waves:

  1. Providing the core components and options to create a functioning, beautiful modal.
  2. Providing the ability to customize these components by passing styles in to the Modali components.

I'm really interested to hear your thoughts (and anyone else who may be listening!).

from modali.

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.