@@ -17,7 +17,7 @@ import {
17
17
} from 'react-aria-components' ;
18
18
import { bar , track } from './bar-utils' with { type : 'macro' } ;
19
19
import { createContext , forwardRef , ReactNode } from 'react' ;
20
- import { DOMRef , DOMRefValue } from '@react-types/shared' ;
20
+ import { DOMRef , DOMRefValue , LabelPosition } from '@react-types/shared' ;
21
21
import { FieldLabel } from './Field' ;
22
22
import { fieldLabel , getAllowedOverrides , StyleProps } from './style-utils' with { type : 'macro' } ;
23
23
import { size , style } from '../style' with { type : 'macro' } ;
@@ -37,8 +37,15 @@ interface MeterStyleProps {
37
37
* @default 'M'
38
38
*/
39
39
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
42
49
}
43
50
44
51
export interface MeterProps extends Omit < AriaMeterProps , 'children' | 'className' | 'style' > , MeterStyleProps , StyleProps {
@@ -106,6 +113,7 @@ function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {
106
113
UNSAFE_className = '' ,
107
114
UNSAFE_style,
108
115
variant = 'informative' ,
116
+ labelPosition = 'top' ,
109
117
...groupProps
110
118
} = props ;
111
119
@@ -118,11 +126,11 @@ function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {
118
126
size,
119
127
variant,
120
128
staticColor,
121
- labelPosition : 'top'
129
+ labelPosition
122
130
} , styles ) } >
123
131
{ ( { percentage, valueText} ) => (
124
132
< >
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 > }
126
134
{ label && < Text styles = { valueStyles ( { size, labelAlign : 'end' , staticColor} ) } > { valueText } </ Text > }
127
135
< SkeletonWrapper >
128
136
< div className = { trackStyles ( { staticColor, size} ) } >
0 commit comments