Skip to content

Commit 32549f8

Browse files
committed
library: add textStyle parameter to TextButton
1 parent 09f6371 commit 32549f8

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/components/button.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Button(
103103
| minHeight | Dp | Minimum height of the button | ButtonDefaults.MinHeight | No |
104104
| colors | TextButtonColors | Text button color configuration | ButtonDefaults.textButtonColors() | No |
105105
| insideMargin | PaddingValues | Internal padding of the button | ButtonDefaults.InsideMargin | No |
106+
| textStyle | TextStyle? | Text style of the button text | null (MiuixTheme.textStyles.button)| No |
106107
| interactionSource | MutableInteractionSource? | Interaction source for the button | null | No |
107108
| indication | Indication? | Indication for click interactions | LocalIndication.current | No |
108109

docs/zh_CN/components/button.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Button(
103103
| minHeight | Dp | 按钮最小高度 | ButtonDefaults.MinHeight ||
104104
| colors | TextButtonColors | 文本按钮颜色配置 | ButtonDefaults.textButtonColors() ||
105105
| insideMargin | PaddingValues | 按钮内部边距 | ButtonDefaults.InsideMargin ||
106+
| textStyle | TextStyle? | 按钮文本的文本样式 | null(MiuixTheme.textStyles.button)||
106107
| interactionSource | MutableInteractionSource? | 按钮的交互源 | null ||
107108
| indication | Indication? | 点击交互的反馈效果 | LocalIndication.current ||
108109

miuix-ui/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import androidx.compose.ui.graphics.Color
2424
import androidx.compose.ui.semantics.Role
2525
import androidx.compose.ui.semantics.role
2626
import androidx.compose.ui.semantics.semantics
27+
import androidx.compose.ui.text.TextStyle
2728
import androidx.compose.ui.unit.Dp
2829
import androidx.compose.ui.unit.dp
2930
import top.yukonga.miuix.kmp.squircle.squircleSurface
@@ -117,6 +118,7 @@ fun TextButton(
117118
minHeight: Dp = ButtonDefaults.MinHeight,
118119
colors: TextButtonColors = ButtonDefaults.textButtonColors(),
119120
insideMargin: PaddingValues = ButtonDefaults.InsideMargin,
121+
textStyle: TextStyle? = null,
120122
interactionSource: MutableInteractionSource? = null,
121123
indication: Indication? = LocalIndication.current,
122124
) {
@@ -142,7 +144,7 @@ fun TextButton(
142144
) {
143145
Text(
144146
text = text,
145-
style = MiuixTheme.textStyles.button,
147+
style = textStyle ?: MiuixTheme.textStyles.button,
146148
)
147149
}
148150
}

0 commit comments

Comments
 (0)