UsageMeterField

Renders a usage-vs-quota value as a progress meter.

Installation

pnpm dlx shadcn@latest add @chelone/usage-meter-field
Loading preview…

Renders a usage-vs-quota value as a progress meter.

Props

PropTypeDefaultDescription
cellClassNamestring—A class name to apply to the cell element when used inside `<DataTable>`.
classNamestring—A class name to apply to the root element.
defaultValueSourceValue<RecordType, SourceProp<RecordType>>—
emptyReactNode—The node to display when the field value is empty. Defaults to nothing. A string is translated; a ReactNode renders as-is.
headerClassNamestring—A class name to apply to the header cell element when used inside `<DataTable>`.
labelReactNode—Label to use as column header when using `<DataTable>` or `<SimpleShowLayout>`. Defaults to the capitalized field name. Set to `false` to disable the label.
limitSourceSourceKey<RecordType>—Sibling record field holding the limit/quota; the bar is only shown when set. A top-level key, not a path: the read is `record[limitSource]`.
recordRecordType—The record to render. Defaults to the ambient `RecordContext` value.
resourcestring—The resource name. Defaults to the ambient `ResourceContext` value.
sortableboolean—Disable the header click handler when used inside `<DataTable>`.
sortBystring—The field to sort by when this column head is clicked, if sortable.
sortByOrderSortOrder—The order used for sorting when this column head is clicked, if sortable.
sourceSourceProp<RecordType>—Name of the property to display (dot/bracket path).
textAlignTextAlign—The text alignment for the cell content, when used inside `<DataTable>`.
thresholds{ critical: number; warning: number }—Ratio thresholds for warning + critical states. Defaults `{ warning: 0.8, critical: 1.0 }`.
unitstring—Optional unit suffix (e.g. "GB", "requests").