Skip to content

React library for building declarative toggle components

License

Notifications You must be signed in to change notification settings

vigosan/react-togglr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-togglr

React library for building declarative toggle components

Example

const UserProfileDropdown = ({ avatarUrl, name }) => (
  <Toggle
    render={({ on, toggle }) => (
      <div className="UserProfileDropdown">
        <img className="UserProfileDropdown-avatar" src={avatarUrl} />
        <span className="UserProfileDropdown-name" onClick={toggle}>
          {name}{' '}
          <img
            src={arrow}
            className={`UserProfileDropdown-arrow ${on
              ? 'UserProfileDropdown-arrow--on'
              : ''} `}
          />
        </span>
        {on ? <Menu /> : null}
      </div>
    )}
    onToggle={({ on }) => console.log(`${on ? 'ON' : 'OFF'}`)}
  />
);

Built With

Authors

  • Vicent Gozalbes - Initial work - vigosan

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

React library for building declarative toggle components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published