- Getting Started
- The Basics
- Concepts
- SuperNative
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Icons
- Image
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Architecture
You're viewing pre-release documentation — version 4.x is in beta
Features, APIs and behaviour may change before the stable release. View the stable version (3.x)
Badge
Overview#
A small count or text marker, typically used as an overlay on nav items, list rows, or buttons. Renders as a capsule pill.
Per Model 3, colors come from the theme via the semantic variant prop — there are no per-instance overrides.
Copied!
<native:badge :count="3" />
Props#
count- Numeric count. Renders as"99+"for values above 99 (optional, int)label- Arbitrary short text. Wins overcountwhen both are set (optional, string)variant- Color variant (optional, string, default:destructive):destructive—theme.destructive/theme.onDestructiveprimary—theme.primary/theme.onPrimaryaccent—theme.accent/theme.onAccent
a11y-label- Accessibility label (optional)
Examples#
Count badge#
Copied!
<native:row :gap="8" :align-items="1"> <native:icon name="notifications" :size="24" /> <native:badge :count="$unreadCount" /></native:row>
Label badge#
Copied!
<native:badge label="New" variant="primary" />
Anchored to an icon#
Use a <native:stack> to layer the badge over its target:
Copied!
<native:stack :width="40" :height="40"> <native:icon name="cart" :size="32" /> <native:column class="absolute" :top="-2" :right="-2"> <native:badge :count="$cartItems" /> </native:column></native:stack>
Element#
Copied!
use Nativephp\NativeUi\Elements\Badge; Badge::make() ->count(3) ->variant('primary'); Badge::make() ->label('New') ->variant('accent');
make()- Create a badgecount(int $count)- Numeric count (capped display at99+)label(string $text)- Short text label (wins overcount)variant(string $variant)-destructive | primary | accenta11yLabel(string $value)- Accessibility label
Plugin Dev Kit
Build native plugins with
Claude Code
Learn More
NativePHP Ultra
All NativePHP plugins, teams & priority support from
$35/mo
Learn More
The Vibes
The unofficial Laracon US
Day 3
Grab Your Spot
Only 100 tickets!
The Masterclass
Go from zero to
published app
in no time
in no time
Learn More
Early Bird Pricing