npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semantic-ui-react-transition-modal

v0.1.2

Published

A simple animation wrapper over the Semantic UI React modal component

Downloads

77

Readme

semantic-ui-react-transition-modal

Semantic UI React Transition Modal

A simple animation wrapper over the Semantic UI React modal component.

Premise

Without an official modal animation feature set in stone by Semantic UI React (see this issue), one has to make workarounds. This library aims to fill that in by merging the animation props of the <Transition> component and the visibility state control props of the <Modal> component into one convenient set.

Usage

semantic-ui-react-transition-modal

NPM

npm install --save react
npm install --save react-dom
npm install --save semantic-ui-react
npm install --save semantic-ui-react-transition-modal

Yarn

yarn add react
yarn add react-dom
yarn add semantic-ui-react
yarn add semantic-ui-react-transition-modal

This library was written in TypeScript. So, typings have already been provided. No further installation is required on your end.

Simply import TransitionModal in order to use it. It also comes prepackaged with the usual Modal subcomponents, with no modifications, so you can use them as you usually do:

  • TransitionModal.Header
  • TransitionModal.Content
  • TransitionModal.Description
  • TransitionModal.Actions

Example

import React from 'react';
import { Button } from 'semantic-ui-react';
import { TransitionModal } from 'semantic-ui-react-transition-modal';

import logo from './logo.svg';
import './App.css';

import 'semantic-ui-css/semantic.min.css';

export function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <TransitionModal
          animation="fade up"
          duration={250}
          trigger={(
            <Button
              content="Hello!"
            />
          )}
          closeIcon
          content="Hello!"
          header="Hello!"
          actions={[
            'OK',
          ]}
        />
        <p>
          Edit <code>src/App.tsx</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
};

API

This library uses a combination of props from Semantic UI React's <Transition> and <Modal> components. Since this library is mostly just a simple wrapped component, the recommended way to understand the API is to refer to the official documentation.

The only notable exception is the exclusion of some props which is necessary in order to make the <TransitionModal /> component work:

| Component | Prop | Reason to exclude | |------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <Transition> | visible | The <Modal>'s open prop will provide the same functionality, making this prop redundant. | | <Transition> | unmountOnHide | The <Modal>'s ability to close is influenced by the <Transition>'s ability to unmount the component within it when closed. If this prop was allowed to be set to false, the <Modal> will not be able to be closed once opened. There should be no risk here; <Modal> unmounts its contents the same way this library unmounts its <Modal>'s contents, so, the expected behavior should be roughly equivalent. | | <Modal> | open | Not quite an exclusion, but note that this prop will affect both the visible state of <Transition> and the open state of <Modal>. |

This library is controlled autonomously by its open prop if it has not been provided externally. You may use this component uncontrolled.

Resources