GithubHelp home page GithubHelp logo

needim / react-useoverlay Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 0.0 1.94 MB

if floating-ui and framer-motion had a baby

Home Page: https://ned.im/react-useoverlay

License: MIT License

TypeScript 100.00%
floating floating-ui tooltip

react-useoverlay's Introduction

Create floating things easily

useOverlay uses floating-ui and framer-moting under the hood, giving you an API that provides great usability.

Warning Documentation is not complete! useOverlay is a very fresh hook. API can be changed.

Note You should know! For styling useOverlay doesn't do anything than passing className parameter to floating overlay for now. You can use Tailwind or some other solutions.

npm install react-useoverlay

Why Floating UI?

Floating UI is a tiny, low-level library for creating "floating" elements. The library provides two key functionalities:

1. Anchored positioning primitives

CSS is currently missing a feature called “anchored positioning” — the ability to anchor an element (like a tooltip) to another one (like a button) while simultaneously keeping it in view as best as possible by avoiding clipping and overflow. Attempting to do fully dynamic anchored positioning with today’s plain CSS is not possible. Floating UI provides a JavaScript implementation of this feature.

2. User interaction primitives

When creating a popover, dropdown menu, select, or combobox component that follows WAI-ARIA authoring practices, the complexity increases dramatically. Focus traps, indexed navigation, and typeahead are difficult to get right. This functionality is currently available for React DOM but will be made agnostic in the future.


Why framer-motion?

1. Production-ready motion library for React

Utilize the power behind Framer, the best prototyping tool for teams. Proudly open source.

2. Simple declarative syntax means you write less code

Less code means your codebase is easier to read and maintain. Animations that work like magic. When animating between two separate components, Framer Motion will take care of everything in between.


Why useOverlay?

1. Because it simplifies the API you need to deal with it.

That's it.

Use cases

  • If you don't wanna handle all the logic of floating elements
  • If you are building your own UI Library
  • If you wanna create a custom build floating overlays

react-useoverlay's People

Contributors

needim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.