Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/button

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/button

leafyGreen UI Kit Button

  • 8.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34K
increased by54.1%
Maintainers
4
Weekly downloads
 
Created
Source

Button

npm (scoped)

View on Storybook

Installation

Yarn

yarn add @leafygreen-ui/button

NPM

npm install @leafygreen-ui/button

Peer Dependencies

PackageVersion
@leafygreen-ui/leafygreen-provider^1.1.0

Example

import Button from '@leafygreen-ui/button';

<Button
  variant="primary"
  className="create-item-button"
  title="Create an item"
  onClick={event => {
    /* Something to handle the click event */
  }}
>
  Submit
</Button>;

Output HTML

<button
  class="css-1rgbgdt create-item-button"
  title="Create an item"
  disabled="false"
>
  Submit
</button>

Properties

PropTypeDescriptionDefault
variant'default', 'primary', 'info', 'danger', 'dark'Sets the style variant of the button.'default'
size'xsmall', 'small', 'normal', 'large'Sets the size variant of the button.'normal'
childrennodeThe content that will appear inside of the <Button /> component.null
onClickfunctionThe event handler function for the 'onclick' event. Receives the associated event object as the first argument.
classNamestringAdds a className to the class attribute.''
valuestringSets the HTML value attribute.
disabledbooleanDisabled the buttonfalse
asReact.ElementTypeDetermines the root element. For example, Link or a tags can be supplied to replace button from being the DOM element that wraps the component.button
hrefstringIf a href is supplied it will change the as value, such that the component renders inside of an a tag instead of inside of a button tag.

Any other properties will be spread on the input element.

Note: In order to make this Component act as a submit button, the recommended approach is to pass submit as the type prop. Note it is also valid to pass input to the as prop, and the button's content's to the value prop -- in this case, do not supply children to the component.

FAQs

Package last updated on 12 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc