OudsButton
An OUDS button which displays text only.
The colors of this button are automatically adjusted when it is displayed in an OudsColoredBox. Some tokens associated with these specific colors can be customized and are identified with the Mono
suffix (for instance OudsButtonTokens.colorBgDefaultEnabledMono).
Parameters
Text displayed in the button.
Callback invoked when the button is clicked.
Modifier applied to the button.
Controls the enabled state of the button when style is equal to OudsButton.Style.Default. When false
, this button will not be clickable. Has no effect when style is equal to OudsButton.Style.Loading.
The button style.
The button hierarchy. A button with OudsButton.Hierarchy.Negative hierarchy is not allowed as a direct or indirect child of an OudsColoredBox and will throw an IllegalStateException.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsButton(
text = "Text",
onClick = { /* Do something! */ }
)
//sampleEnd
}
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsColoredBox(color = OudsColorKeyToken.Surface.Status.Info.Emphasized) {
// The colors of this button are automatically adjusted to maximize the contrast with the colored background.
OudsButton(
text = "Text",
onClick = { /* Do something! */ }
)
}
//sampleEnd
}
An OUDS button which displays an icon only.
The colors of this button are automatically adjusted when it is displayed in an OudsColoredBox. Some tokens associated with these specific colors can be customized and are identified with the Mono
suffix (for instance OudsButtonTokens.colorBgDefaultEnabledMono).
Parameters
Icon displayed in the button.
Callback invoked when the button is clicked.
Modifier applied to the button.
Controls the enabled state of the button when style is equal to OudsButton.Style.Default. When false
, this button will not be clickable. Has no effect when style is equal to OudsButton.Style.Loading.
The button style.
The button hierarchy. A button with OudsButton.Hierarchy.Negative hierarchy is not allowed as a direct or indirect child of an OudsColoredBox and will throw an IllegalStateException.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Content description"
),
onClick = { /* Do something! */ }
)
//sampleEnd
}
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsColoredBox(color = OudsColorKeyToken.Surface.Status.Info.Emphasized) {
// The colors of this button are automatically adjusted to maximize the contrast with the colored background.
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Content description"
),
onClick = { /* Do something! */ }
)
}
//sampleEnd
}
An OUDS button which displays an icon and text.
The colors of this button are automatically adjusted when it is displayed in an OudsColoredBox. Some tokens associated with these specific colors can be customized and are identified with the Mono
suffix (for instance OudsButtonTokens.colorBgDefaultEnabledMono).
Parameters
Icon displayed in the button.
Text displayed in the button.
Callback invoked when the button is clicked.
Modifier applied to the button.
Controls the enabled state of the button when style is equal to OudsButton.Style.Default. When false
, this button will not be clickable. Has no effect when style is equal to OudsButton.Style.Loading.
The button style.
The button hierarchy. A button with OudsButton.Hierarchy.Negative hierarchy is not allowed as a direct or indirect child of an OudsColoredBox and will throw an IllegalStateException.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Content description"
),
text = "Text",
onClick = { /* Do something! */ }
)
//sampleEnd
}
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsColoredBox(color = OudsColorKeyToken.Surface.Status.Info.Emphasized) {
// The colors of this button are automatically adjusted to maximize the contrast with the colored background.
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Content description"
),
text = "Text",
onClick = { /* Do something! */ }
)
}
//sampleEnd
}