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

abaabil.button

Package Overview
Dependencies
Maintainers
0
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil.button

[![npm version](https://img.shields.io/npm/v/abaabil.button.svg)](https://www.npmjs.com/package/abaabil.button) [![npm downloads](https://img.shields.io/npm/dm/abaabil.button.svg)](https://www.npmjs.com/package/abaabil.button)

  • 0.0.22
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
0
Weekly downloads
 
Created
Source

Button Component

npm version npm downloads

The Button component is a versatile and customizable button component built with React. It supports different variants, sizes, icons, and states, making it suitable for a wide range of use cases.

Overview

The Button component is used to display buttons in your application. This documentation provides instructions on how to use the Button component in your React projects. The Button component is a part of the abaabil.button library.

Importing the Button Component

You can import the Button component from the abaabil package or directly from the abaabil.button package.

import { Button } from 'abaabil';
// or
import Button from 'abaabil.button';

Usage Example

The Button component can be used in your JSX to display buttons with various properties. You can customize the button by setting its properties such as icon, actionIcon, variant, size, disabled, outlined, and className.

import * as React from 'react';
import Button from 'abaabil.button';

const App = () => (
  <div>
    <Button variant="primary" size="base">Primary Button</Button>
    <Button variant="secondary" size="lg" icon="settings">Secondary Button</Button>
    <Button variant="success" size="sm" actionIcon="check" fullWidth>Success Button</Button>
    <Button variant="error" outlined>Outlined Error Button</Button>
    <Button variant="tertiary" disabled>Tertiary Disabled Button</Button>
  </div>
);

export default App;

More Usage Examples

Filled Variants
import * as React from 'react';
import Button from 'abaabil.button';

const FilledVariantsExample = () => (
  <div className="flex flex-wrap gap-4">
    <Button icon="photo">Primary</Button>
    <Button variant="secondary" icon="photo">Secondary</Button>
    <Button variant="tertiary" icon="photo">Tertiary</Button>
    <Button variant="success" icon="photo">Success</Button>
    <Button variant="error" icon="photo">Error</Button>
  </div>
);

export default FilledVariantsExample;
Disabled Filled Variants
import * as React from 'react';
import Button from 'abaabil.button';

const DisabledFilledVariantsExample = () => (
  <div className="flex flex-wrap gap-4">
    <Button icon="photo" disabled>Primary</Button>
    <Button variant="secondary" icon="photo" disabled>Secondary</Button>
    <Button variant="tertiary" icon="photo" disabled>Tertiary</Button>
    <Button variant="success" icon="photo" disabled>Success</Button>
    <Button variant="error" icon="photo" disabled>Error</Button>
  </div>
);

export default DisabledFilledVariantsExample;
Outlined Variants
import * as React from 'react';
import Button from 'abaabil.button';

const OutlinedVariantsExample = () => (
  <div className="flex flex-wrap gap-4">
    <Button icon="photo" outlined>Primary</Button>
    <Button variant="secondary" icon="photo" outlined>Secondary</Button>
    <Button variant="tertiary" icon="photo" outlined>Tertiary</Button>
    <Button variant="success" icon="photo" outlined>Success</Button>
    <Button variant="error" icon="photo" outlined>Error</Button>
  </div>
);

export default OutlinedVariantsExample;
Disabled Outlined Variants
import * as React from 'react';
import Button from 'abaabil.button';

const DisabledOutlinedVariantsExample = () => (
  <div className="flex flex-wrap gap-4">
    <Button icon="photo" outlined disabled>Primary</Button>
    <Button variant="secondary" icon="photo" outlined disabled>Secondary</Button>
    <Button variant="tertiary" icon="photo" outlined disabled>Tertiary</Button>
    <Button variant="success" icon="photo" outlined disabled>Success</Button>
    <Button variant="error" icon="photo" outlined disabled>Error</Button>
  </div>
);

export default DisabledOutlinedVariantsExample;
Sizes
import * as React from 'react';
import Button from 'abaabil.button';

const ButtonSizesExample = () => (
  <div className="flex flex-wrap gap-4">
    <Button size="sm" icon="photo">Small</Button>
    <Button icon="photo">Base</Button>
    <Button size="lg" icon="photo">Large</Button>
  </div>
);

export default ButtonSizesExample;

Props

PropTypeDefaultDescription
asstringbuttonThe HTML element or React component to render.
iconstringnullIcon to display in the button. Uses the Icon component.
actionIconstringnullIcon to display on the right side of the button. Uses the Icon component.
variantstringprimaryThe button variant. Can be primary, secondary, tertiary, success, or error.
sizestringbaseThe size of the button. Can be sm, base, or lg.
disabledbooleanfalseWhether the button is disabled.
outlinedbooleanfalseWhether the button is outlined.
childrennodenullThe content of the button.
isPressedbooleanfalseThe pressed state of the button.
classNamestring''Additional class names to apply to the button.
fullWidthbooleanfalseWhether the button should take the full width of its container.
roundedbooleanfalseWhether the button should have rounded corners.
...propsobject{}Additional props to pass to the button.

Variants

  • primary: Default button style with primary background and text.
  • secondary: Secondary button style with secondary background and text.
  • tertiary: Tertiary button style with tertiary background and text.
  • success: Success button style with success background and text.
  • error: Error button style with error background and text.

Sizes

  • sm: Small button size.
  • base: Base button size.
  • lg: Large button size.

States

  • Disabled: Button with disabled prop applied. Can be combined with outlined for different styles.
  • Outlined: Button with outlined prop applied.

Icons

  • icon: Icon to display in the button, using the Icon component.
  • actionIcon: Icon to display on the right side of the button, using the Icon component.

Example

import * as React from 'react';
import Button from 'abaabil.button';

const Example = () => (
  <div>
    <Button variant="primary" size="base">Primary Button</Button>
    <Button variant="secondary" size="lg" icon="settings">Secondary Button</Button>
    <Button variant="success" size="sm" actionIcon="check" fullWidth>Success Button</Button>
    <Button variant="error" outlined>Outlined Error Button</Button>
    <Button variant="tertiary" disabled>Tertiary Disabled Button</Button>
  </div>
);

export default Example;

This example demonstrates various ways to use the Button component, showcasing different variants, sizes, icons, and states.

Keywords

FAQs

Package last updated on 11 Aug 2024

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