Photonix

SegmentedBarWidget

A card widget displaying a segmented progress bar with custom striped hatching patterns, a trend indicator, and item breakdowns.

Preview

Income Breakdown

37%Spent
$2,450.00 left
↗ 12%last month
Needs
45 %
Transportations
20 %
Entertainment
10 %
Usage
"use client";

import React from 'react';
import { SegmentedBarWidget, type SegmentedBarItem } from '@photonix/ultimate';

const items: SegmentedBarItem[] = [
    { 
        id: 'needs', 
        label: 'Needs', 
        value: 45, 
        color: 'var(--color-blue-500, #3b82f6)' 
    },
    { 
        id: 'transportation', 
        label: 'Transportations', 
        value: 20, 
        color: 'var(--color-cyan-500, #06b6d4)' 
    },
    { 
        id: 'entertainment', 
        label: 'Entertainment', 
        value: 10, 
        color: 'var(--color-amber-500, #f59e0b)' 
    },
];

export default function SegmentedBarWidgetBasicExample() {
    return (
        <div style={{ maxWidth: '420px', margin: '0 auto', width: '100%' }}>
            <SegmentedBarWidget
                title="Income Breakdown"
                valueLabel="37%"
                valueDescription="Spent"
                subValueLabel="$2,450.00 left"
                trend={{
                    value: "12%",
                    label: "last month",
                    direction: "up"
                }}
                items={items}
                total={100}
                onInfoClick={() => {}}
                onMoreClick={() => {}}
            />
        </div>
    );
}

Component API

SegmentedBarWidget

Prop
Type
Default
Description
title
React.ReactNode
-
Title of the widget
subtitle
string
-
Subtitle/description of the widget
valueLabel
React.ReactNode
-
The main value value (e.g., "37%")
valueDescription
React.ReactNode
-
Description next to the main value (e.g., "Spent")
subValueLabel
React.ReactNode
-
Label showing left/remaining value (e.g., "$2,450.00 left")
trend
{ value: string; label?: string; direction?: "up" | "down"; }
-
Optional trend information
items
SegmentedBarItem[]
[]
Data items representing segments of the progress bar
gap
number
8
Gap size between bar segments in pixels. Defaults to 8.
total
number
-
Total scale. If not provided, it defaults to the sum of item values or 100.
icon
React.ReactNode
-
Overrides the default Layers/Stack icon in the header
actions
React.ReactNode
-
Custom actions for header
loading
boolean
false
Loading state
appearance
WidgetAppearance
'outlined'
Widget appearance
padding
string | number
-
Widget padding
style
React.CSSProperties
-
className
string
-
onInfoClick
(() => void)
-
Callback when info icon is clicked
onMoreClick
(() => void)
-
Callback when more actions button is clicked

On this page

Preview
Component API
Photonix UI - React Components, Templates & Figma Design System