@pikas-ui/badge

This package contains a badge component that can be used to show a notification or a label.

Change Log

Requirements

To use this package, you must install the @pikas-ui/styles package.

Installation

You can install this package using npm, yarn, or pnpm.

npm install @pikas-ui/badge
yarn add @pikas-ui/badge
pnpm add @pikas-ui/badge

Usage

Badge

The badge component can be used to show a notification or a label.

Bread
Bread
Bread
import { Badge } from '@pikas-ui/badge';
import { IconByName, IconProps } from '@pikas-ui/icons';

const IconExample: FC<IconProps> = (props) => (
  <IconByName {...props} name="bx:baguette" />
);

const Example: React.FC = () => {
  return <Badge LeftIcon={IconExample}>Bread</Badge>;
};

Props

Props extends HTMLAttributes<HTMLDivElement>.

PropDescriptionTypeDefault
childrenThe content of the badge.ReactNode-
colorNameThe color of the badge.PikasColors"primary"
colorHexThe color of the badge.string-
boxShadowThe shadow of the badge.PikasShadow"bottom-sm"
borderRadiusThe border radius of the badge.PikasRadius"full"
cssThe css of the badge.PikasCSS-
fontSizeThe font size of the badge.PikasFontSize"em-base"
LeftIconThe left icon of the badge.FC<IconProps>-
RightIconThe right icon of the badge.FC<IconProps>-
leftIconPropsThe left icon props.IconProps-
rightIconPropsThe right icon props.IconProps-
gapThe gap of the badge.BadgeGap"md"
paddingThe padding of the badge.BadgePadding"md"

BadgeIcon

The badge icon component can be used to show a notification or a label with an icon.

import { BadgeIcon } from '@pikas-ui/badge';
import { IconByName, IconProps } from '@pikas-ui/icons';

const IconExample: FC<IconProps> = (props) => (
  <IconByName {...props} name="bx:baguette" />
);

const Example: React.FC = () => {
  return <BadgeIcon Icon={IconExample} />;
};

Props

Props extends HTMLAttributes<HTMLDivElement>.

PropDescriptionTypeDefault
IconThe icon of the badge.LeftIconrequired
iconPropsThe icon props of the badge.IconProps-
childrenThe content of the badge.ReactNode-
colorNameThe color of the badge.PikasColors"primary"
colorHexThe color of the badge.string-
boxShadowThe shadow of the badge.PikasShadow"bottom-sm"
borderRadiusThe border radius of the badge.PikasRadius"full"
cssThe css of the badge.PikasCSS-
sizeThe size of the badge.number24
paddingThe padding of the badge.BadgePadding"md"

CustomBadge

You can use the custom badge component to create your own badge.

Hello world
Hello world
Hello world
import { CustomBadge } from '@pikas-ui/badge';

const Example: React.FC = () => {
  return (
    <CustomBadge
      css={{
        fontSize: '$em-small',
        padding: '8px 16px',
      }}
    >
      Hello world
    </CustomBadge>
  );
};

Props

Props extends HTMLAttributes<HTMLDivElement>.

PropDescriptionTypeDefault
childrenThe content of the badge.ReactNode-
colorNameThe color of the badge.PikasColors"primary"
colorHexThe color of the badge.string-
boxShadowThe shadow of the badge.PikasShadow"bottom-sm"
borderRadiusThe border radius of the badge.PikasRadius"full"
cssThe css of the badge.PikasCSS-

Contributing

This documentation can be edited on GitHub here