Skip to content

Commit

Permalink
adding style to label component (#609) (#610)
Browse files Browse the repository at this point in the history
Co-authored-by: PraveenKumar <[email protected]>
  • Loading branch information
praveen970 and PraveenKumar authored Feb 7, 2024
1 parent 512eb39 commit 17061d2
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import com.microsoft.fluentui.theme.FluentTheme
import com.microsoft.fluentui.theme.token.ControlTokens
import com.microsoft.fluentui.theme.token.FluentAliasTokens.TypographyTokens
Expand All @@ -17,7 +18,12 @@ import com.microsoft.fluentui.theme.token.controlTokens.LabelTokens
* @param text Label text
* @param textStyle Text styling for the text. Default [TypographyTokens.Display]
* @param colorStyle Color styling for the text. Default [ColorStyle.Primary]
* @param textColorOverride Optional override for text color. Default is null. When set colorStyle is ignored.
* @param textColorOverride Optional override for text color. Default is null. When set colorStyle is ignored. This param is deprecated and will be removed in future releases. use [style] to override text color
* @param style Optional style for the text
* @param overflow TextOverflow value. Default is [TextOverflow.Clip]
* @param softWrap Whether the text should wrap when it reaches the end of the line. Default is true
* @param maxLines Maximum number of lines to display. Default is Int.MAX_VALUE
* @param minLines Minimum number of lines to display. Default is 1
* @param modifier Optional modifier for Label
* @param labelTokens Option tokens for label styling
*/
Expand All @@ -27,6 +33,11 @@ fun Label(
textStyle: TypographyTokens = TypographyTokens.Display,
colorStyle: ColorStyle = ColorStyle.Primary,
textColorOverride: Color? = null,
style: TextStyle? = null,
overflow: TextOverflow = TextOverflow.Clip,
softWrap: Boolean = true,
maxLines: Int = Int.MAX_VALUE,
minLines: Int = 1,
modifier: Modifier = Modifier,
labelTokens: LabelTokens? = null
) {
Expand All @@ -40,6 +51,10 @@ fun Label(
BasicText(
modifier = modifier,
text = text,
style = textStyle.merge(TextStyle(color = textColor))
style = textStyle.merge(TextStyle(color = textColor)).merge(style),
overflow = overflow,
softWrap = softWrap,
maxLines = maxLines,
minLines = minLines
)
}

0 comments on commit 17061d2

Please sign in to comment.