• Stars
    star
    165
  • Rank 228,906 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Modal from Ant Design, draggable.

Ant Design Draggable Modal

Modal from Ant Design, draggable.

Version Downloads BundlePhobia MIT License

Watch on GitHub Star on GitHub Tweet

๐ŸŒŽ Example

โœจ Features

  • Drag with title bar.
  • Resize with handle.
  • Keep in bounds.
    • During drag.
    • During resize.
    • During resize window.
  • Multiple modals with managed zIndex.
  • Open from center.
  • Better API for using as a controlled component.
  • Open from quadrants.
  • Better escape key management.
  • Resize with option key.

๐Ÿ“ฆ Install

yarn add ant-design-draggable-modal

NOTE: You must use [email protected] and [email protected] or higher.

๐Ÿ”จ Usage

import React, { useState, useCallback } from 'react'
import { Button } from 'antd'
import { DraggableModal, DraggableModalProvider } from 'ant-design-draggable-modal'
import 'antd/dist/antd.css'
import 'ant-design-draggable-modal/dist/index.css'

const ModalWithButton = () => {
    const [visible, setVisible] = useState(false)
    const onOk = useCallback(() => setVisible(true), [])
    const onCancel = useCallback(() => setVisible(false), [])
    return (
        <>
            <Button onClick={onOk}>Open</Button>
            <DraggableModal visible={visible} onOk={onOk} onCancel={onCancel}>
                Body text.
            </DraggableModal>
        </>
    )
}

// DraggableModalProvider manages the zIndex
// of DraggableModals rendered beneath it.
const App = () => (
    <DraggableModalProvider>
        <ModalWithButton />
        <ModalWithButton />
        <ModalWithButton />
    </DraggableModalProvider>
)

โš ๏ธ User Experience Warning

You should probably try to design your app not to need to use this, apps should usually not be window managers.

License

MIT ยฉ DylanVann

More Repositories

1

react-native-fast-image

๐Ÿšฉ FastImage, performant React Native image component.
TypeScript
8,180
star
2

DatePickerCell

๐Ÿ“… Inline/Expanding date picker for table views.
Swift
326
star
3

react-native-progressive-image

๐ŸŒ ProgressiveImage, progressively load images with React Native.
Objective-C
205
star
4

perfect-dark-mode

๐ŸŒš๐ŸŒ Perfect Dark Mode
TypeScript
92
star
5

beezel

Remote build caching for JS monorepos.
TypeScript
31
star
6

i18next-react-native-language-detector

i18next react native language detection.
JavaScript
25
star
7

check-pull-request-title

A GitHub action that checks that a PR title matches a regex pattern.
TypeScript
21
star
8

yarn-workspaces-to-typescript-project-references

Sync Yarn workspace dependencies with TypeScript project references.
TypeScript
21
star
9

react-native-locale-detector

Detects the locale of a user's phone.
Java
17
star
10

typescript-migration-demo

Example of how to incrementally migrate an app to TypeScript.
JavaScript
13
star
11

use-persisted

Persisted versions of useState and useReducer.
TypeScript
12
star
12

redux-saga-request

๐Ÿž Redux Saga Request, request helper for Redux Saga.
JavaScript
11
star
13

react-native-blur-image

React Native Image with cross platform blurRadius property.
Java
10
star
14

redux-shorthand-example

Example of how to use redux shorthand.
JavaScript
9
star
15

gatsby-transformer-cloudinary

Gatsby transformer for Cloudinary.
TypeScript
8
star
16

presskit-static

๐Ÿ—ž A static version of presskit(), with Grunt/Jade/SASS/YAML.
HTML
8
star
17

ColorLockView

UITableViewCell highlighting does not change the color of ColorLockViews.
Swift
7
star
18

react-fast-image

๐Ÿšฉ FastImage, performant React image component.
TypeScript
6
star
19

media.macro

Babel macro to load media.
TypeScript
6
star
20

babelts

Run TypeScript code with Babel.
JavaScript
5
star
21

react-video-tag

Render <video> in React using dangerouslySetInnerHTML.
TypeScript
5
star
22

advent-of-code-2019

Solutions to Advent of Code 2019.
Reason
5
star
23

react-native-camera-roll

Native module to get photos from the device.
Objective-C
5
star
24

media-server

Solution for image and video processing using S3/Lambda/API Gateway/CloudFront.
TypeScript
5
star
25

dv-scripts

Scripts for Node/TypeScript development.
TypeScript
4
star
26

dylans-codemods

Dylan's codemods.
JavaScript
3
star
27

react-splt

A tiny (1kb) React component for split panes (written in ReasonML).
JavaScript
3
star
28

gatsby-cloudinary

This module powers gatsby-remark-cloudinary and gatsby-transformer-cloudinary.
TypeScript
2
star
29

node-docker-monorepo-example

TypeScript
2
star
30

print-yarn-workspace-graph

Print the dependency graph of a yarn workspace.
JavaScript
2
star
31

gatsby-remark-cloudinary

Convert markdown images and videos into custom components with Cloudinary urls.
TypeScript
2
star
32

react-cleaner-markup-example

Example of how you can use React 16 to produce cleaner markup.
JavaScript
1
star
33

rely-example

Example of rely testing.
OCaml
1
star
34

com_dylanvann_bazel_test

Python
1
star
35

bundler-and-compiler-benchmarks

Benchmarks of JavaScript/TypeScript/ReasonML compilation and bundling.
1
star
36

relay-todo-example

Relay + TypeScript + Todo
TypeScript
1
star
37

react-img-tag

This module is for rendering images in React using dangerouslySetInnerHTML.
TypeScript
1
star
38

AIRSensor

An Arduino IR sensor library.
C++
1
star
39

react-native-photo-picker

JavaScript
1
star