---
title: "UiMode"
description: "A [DeviceConfigurationOverride] that overrides the current ui mode type."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun DeviceConfigurationOverride.Companion.UiMode(
    @UiModeType uiModeType: Int
): DeviceConfigurationOverride
```


A `DeviceConfigurationOverride` that overrides the current ui mode type.

#### Parameters

| | |
| --- | --- |
| uiModeType | the uiMode type to render the content under test in. This should be one of the `Configuration.UI_MODE_TYPE_*` values. |


#### Returns

| | |
| --- | --- |
|  | a `DeviceConfigurationOverride` that specifies the uiMode type for the content under test. |




## Code Examples
### DeviceConfigurationOverrideUiMode
```kotlin
@Composable
fun DeviceConfigurationOverrideUiMode() {
    DeviceConfigurationOverride(
        DeviceConfigurationOverride.UiMode(Configuration.UI_MODE_TYPE_CAR)
    ) {
        // will be Configuration.UI_MODE_TYPE_CAR
        LocalConfiguration.current.uiMode and Configuration.UI_MODE_TYPE_MASK
    }
}
```

