Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faet/hng 178 components button/style guide #265

Conversation

shuaibu-shehu
Copy link
Collaborator

@shuaibu-shehu shuaibu-shehu commented Jul 21, 2024

CustomeButton Component Documentation

Overview

The CustomeButton component is a reusable button component with customizable features, supporting different variants, sizes, and optional icons. It also supports an href prop to convert the button into a link.

Props

The CustomeButton component accepts the following props:

leftIcon (optional)

  • Type: React.ReactNode
  • Description: An optional element to be displayed as the left icon inside the button.

rightIcon (optional)

  • Type: React.ReactNode
  • Description: An optional element to be displayed as the right icon inside the button.

isLoading (optional)

  • Type: boolean
  • Description: Displays a spinner on the left side when true.

href (optional)

  • Type: string
  • Description: An optional URL for converting the button into a link.

variant (optional)

  • Type: Variant
  • Default: "default"
  • Description: Specifies the button style variant. Accepted values are:
    • "default"
    • "primary"
    • "destructive"
    • "subtle"
    • "loading"
    • "outline"
    • "secondary"
    • "ghost"
    • "link"

size (optional)

  • Type: Size
  • Default: "default"
  • Description: Specifies the button size. Accepted values are:
    • "default"
    • "sm"
    • "lg"
    • "link"
    • "icon"
    • "circle"

icon (optional)

  • Type: React.ReactNode
  • Description: Text or elements to be displayed inside the button.

children (optional)

  • Type: React.ReactNode
  • Description: Child elements to be displayed inside the button.

isIconOnly (optional)

  • Type: boolean
  • Description: Indicates if the button is icon-only.

isLeftIconVisible (optional)

  • Type: boolean
    • Default.true
  • Description: Indicates if the left icon is visible.

isRightIconVisible (optional)

  • Type: boolean
  • Default.true
  • Description: Indicates if the right icon is visible.

isDisabled (optional)

  • Type: boolean
  • Description: Disables the button if true.

ariaLabel (optional)

  • Type: string
  • Description: Provides an accessible label for the button.

Usage

Basic Usage

Example 1
import React from 'react';
import CustomeButton from './CustomeButton';
import { IconName } from 'your-icon-library';

function App() {
  return (
    <div>
      <CustomeButton variant="primary" size="lg">
        Click Me
      </CustomeButton>
    </div>
  );
}



 Example 2
import React from 'react';
import CustomeButton from './CustomeButton';
import { LoaderIcon } from 'your-icon-library';

function App() {
  return (
    <div>
      <CustomeButton variant="loading" isLoading={true} icon={<LoaderIcon />}>
        Loading...
      </CustomeButton>
    </div>
  );
}

Example 3
import React from 'react';
import CustomeButton from './CustomeButton';

function App() {
  return (
    <div>
      <CustomeButton variant="link" href="https://example.com">
        Visit Example
      </CustomeButton>
    </div>
  );
})

@shuaibu-shehu shuaibu-shehu linked an issue Jul 21, 2024 that may be closed by this pull request
7 tasks
@shuaibu-shehu shuaibu-shehu force-pushed the faet/HNG-178-components-button/style-guide branch from 3a1ef3c to 3c0a346 Compare July 21, 2024 13:55
@shuaibu-shehu shuaibu-shehu deleted the faet/HNG-178-components-button/style-guide branch July 22, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant