@@ -17,7 +17,7 @@ import {
1717} from 'react-aria-components' ;
1818import { bar , track } from './bar-utils' with { type : 'macro' } ;
1919import { createContext , forwardRef , ReactNode } from 'react' ;
20- import { DOMRef , DOMRefValue } from '@react-types/shared' ;
20+ import { DOMRef , DOMRefValue , LabelPosition } from '@react-types/shared' ;
2121import { FieldLabel } from './Field' ;
2222import { fieldLabel , getAllowedOverrides , StyleProps } from './style-utils' with { type : 'macro' } ;
2323import { size , style } from '../style' with { type : 'macro' } ;
@@ -37,8 +37,15 @@ interface MeterStyleProps {
3737 * @default 'M'
3838 */
3939 size ?: 'S' | 'M' | 'L' | 'XL' ,
40- /** The static color style to apply. Useful when the button appears over a color background. */
41- staticColor ?: 'white' | 'black'
40+ /**
41+ * The static color style to apply. Useful when the button appears over a color background.
42+ */
43+ staticColor ?: 'white' | 'black' ,
44+ /**
45+ * The label's overall position relative to the element it is labeling.
46+ * @default 'top'
47+ */
48+ labelPosition ?: LabelPosition
4249}
4350
4451export interface MeterProps extends Omit < AriaMeterProps , 'children' | 'className' | 'style' > , MeterStyleProps , StyleProps {
@@ -106,6 +113,7 @@ function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {
106113 UNSAFE_className = '' ,
107114 UNSAFE_style,
108115 variant = 'informative' ,
116+ labelPosition = 'top' ,
109117 ...groupProps
110118 } = props ;
111119
@@ -118,11 +126,11 @@ function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {
118126 size,
119127 variant,
120128 staticColor,
121- labelPosition : 'top'
129+ labelPosition
122130 } , styles ) } >
123131 { ( { percentage, valueText} ) => (
124132 < >
125- { label && < FieldLabel size = { size } labelAlign = "start" labelPosition = "top" staticColor = { staticColor } > { label } </ FieldLabel > }
133+ { label && < FieldLabel size = { size } labelAlign = "start" labelPosition = { labelPosition } staticColor = { staticColor } > { label } </ FieldLabel > }
126134 { label && < Text styles = { valueStyles ( { size, labelAlign : 'end' , staticColor} ) } > { valueText } </ Text > }
127135 < SkeletonWrapper >
128136 < div className = { trackStyles ( { staticColor, size} ) } >
0 commit comments