Skip to content

Commit c637df1

Browse files
committed
Add line height as a style prop
1 parent 04baea3 commit c637df1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

mesop/component_helpers/style.py

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class Style:
112112
height: Sets the height of the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/height).
113113
justify_content: Aligns the flexible container's items on the main-axis. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content).
114114
letter_spacing: Increases or decreases the space between characters in text. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing).
115+
line height: Set the line height (relative to the font size). See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height).
115116
margin: Sets the margin space required on each side of an element. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/margin).
116117
overflow_x: Specifies the handling of overflow in the horizontal direction. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x).
117118
overflow_y: Specifies the handling of overflow in the vertical direction. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y).
@@ -194,6 +195,7 @@ class Style:
194195
"stretch",
195196
] | None = None
196197
letter_spacing: int | str | None = None
198+
line_height: int | str | None = None
197199
margin: Margin | None = None
198200
overflow_x: OverflowValues | None = None
199201
overflow_y: OverflowValues | None = None
@@ -247,6 +249,7 @@ def to_style_proto(s: Style) -> pb.Style:
247249
height=_px_str(s.height),
248250
justify_content=s.justify_content,
249251
letter_spacing=_px_str(s.letter_spacing),
252+
line_height=str(s.line_height),
250253
margin=_map_edge_insets(s.margin),
251254
overflow_x=s.overflow_x,
252255
overflow_y=s.overflow_y,

mesop/protos/ui.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ message UserDefinedType {
217217
repeated Arg args = 1;
218218
}
219219

220-
// Next id: 31
220+
// Next id: 32
221221
message Style {
222222
optional string align_items = 1;
223223
optional string background = 2;
@@ -239,6 +239,7 @@ message Style {
239239
optional string height = 15;
240240
optional string justify_content = 16;
241241
optional string letter_spacing = 17;
242+
optional string line_height = 31;
242243
optional EdgeInsets margin = 18;
243244
optional string overflow_x = 19;
244245
optional string overflow_y = 20;

0 commit comments

Comments
 (0)