Default Image

Badge

Badges are used as a small numerical value or status descriptor for UI elements.

import { Badge } from '@redshank/native';

Examples

Default

Badge with default styles, used in standalone when content prop is empty.

Sizes

Badge with different sizes.

Dot variant

Badge with dot Variant.

Bordered

Bordered badge.

Flat / Pressable

Badge flat variant and pressable element.

Square

Badge square type.

Solid Bordered

Badge with solid Bordered.

With children

Badge with children element.

Placement

Badge with different placement positions.

Enable Shadow

Badge with shadow enable.

Toggle Badge

Badge control visibility.

APIs

Badge Props

Api props extends from View or Touchable Opacity

AttributeTypeAccepted valuesDescriptionDefault
backgroundThemeColor stringThemeColorChange background colorborder
boldbooleantrue falseText bold in the badgetrue
childrenStyleProp<any>objectAccessory as a child for the component-
childrenStylestring ReactNodeanyStyle for children wrapper-
colorThemeColor stringThemeColorChange icon colorprimrary
contentnumber stringNumber TextNumber or text for show in badge-
disableOutlinebooleantrue falseDisable outline border to badgefalse
enableShadowbooleantrue falseEnable shadow badge effectfalse
isInvisiblebooleantrue falseHidden or Show badge-
isPressablebooleantrue falsePressable effect animationfalse
placementPlacementPlacementThe position of the badgetop-right
sizeSizeTypeSizeTypeSize element for showsmall or middle
styleobjectStyleProp<ViewStyle>Style for bbadge-
typeBadgeTypeBadgeTypeBadge shape typerounded
variantBadgeVariantBadgeVariantVariant to show badgedefault
wrapperStyleobjectStyleProp<ViewStyle>Style for wrapper component-
Other PropsanyOther propsInteractive props for element-

Base Properties

type BaseProperties = {
  onBlur?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onFocus?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
  onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
  onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
};

Placement Type

type PlacementType =
  | 'top-right'
  | 'top-left'
  | 'bottom-right'
  | 'bottom-left';

Size Type

type SizeType = 'small' | 'middle' | 'large';

Badge Type

type BadgeType = 'rounded' | 'square'

Badge Variant

type BadgeVariant = 'default' | 'flat' | 'dot' | 'bordered';

Community:

We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

DiscordGithub

Contributing:

PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.

Copyright © 2023 @redshank.