Descripción general de la insignia React

    La insignia Ignite UI for React es un componente que se utiliza junto con avatares, menús de navegación u otros componentes de una aplicación cuando se necesita una notificación visual. Las insignias suelen estar diseñadas con estilos predefinidos para comunicar información, éxito, advertencias o errores.

    React Badge Example

    Usage

    Primero, debes instalar el paquete npm Ignite UI for React correspondiente ejecutando el siguiente comando:

    npm install igniteui-react
    

    You will then need to import the IgrBadge and its necessary CSS like so:

    import { IgrBadge } from 'igniteui-react';
    import 'igniteui-webcomponents/themes/light/bootstrap.css';
    
    <IgrBadge />
    

    To display a subtle border around the badge, you can set the outlined attribute of the badge.

    <IgrBadge outlined={true} ></IgrBadge>
    

    Examples

    Variants

    The Ignite UI for React badge supports several pre-defined stylistic variants. You can change the variant by assigning one of the supported values - primary(default), info, success, warning, or danger to the variant attribute.

    <IgrBadge variant="success" ></IgrBadge>
    

    Shape

    The badge component supports rounded(default) and square shapes. These values can be assigned to the shape attribute.

    <IgrBadge shape="square" ></IgrBadge>
    

    Styling

    The IgrBadge component exposes a base CSS part that can be used to change all of its style properties.

    igc-badge::part(base) {
      background: var(--ig-primary-500);
      color: var(--ig-primary-500-contrast);
      border-radius: 2px;
    }
    

    API References

    Additional Resources