---
title: "RemoteEnum"
description: "A class representing a remote enum value."
type: "class"
lastmod: "2026-06-18T10:32:53.154432Z"
---
## API Reference

> Source set: Android

```kotlin
public open class RemoteEnum<T : Enum<T>>(
    internal val intValue: RemoteInt,
    internal val enumEntries: EnumEntries<T>,
) : BaseRemoteState<T>(RemoteStateInstanceKey())
```

A class representing a remote enum value.

[RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) internally stores its state as a [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt), using the Enum ordinal.

## Secondary Constructors

```kotlin
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public constructor(value: T, enumEntries: EnumEntries<T>) : this(value.ordinal.ri, enumEntries)
```

Constructor for creating a [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) instance from a standard `Enum`.

It converts the standard enum value into a [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) using the Enum ordinal.

#### Parameters

| | |
| --- | --- |
| value | The standard enum value to convert. |

## Properties

### ordinal

> Source set: Android

```kotlin
public val ordinal: RemoteInt
```

Converts this [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) to its underlying [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) representation, using the Enum
ordinal.

#### Returns

| | |
| --- | --- |
|  | The [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) that holds the enum's value. |

## Functions

### toRemoteString

```kotlin
public fun toRemoteString(mapping: (T) -> RemoteString = { it.toString().rs }): RemoteString
```

Converts this [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) to a [RemoteString](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteString) representation.

This method maps each possible enum entry to a string using the provided `mapping` function.
At runtime, the [RemoteString](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteString) will resolve to the string corresponding to the current value
of the enum. Defaults to calling [Any.toString](/jetpack-compose/androidx.compose.runtime/runtime/functions/toString) on the enum entry.

#### Parameters

| | |
| --- | --- |
| mapping | A function that defines how each enum constant should be converted to a [RemoteString](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteString). |

#### Returns

| | |
| --- | --- |
|  | A [RemoteString](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteString) that tracks the string value of this enum. |

### toRemoteInt

```kotlin
public fun toRemoteInt(mapping: (T) -> RemoteInt): RemoteInt
```

Converts this [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) to a [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) representation using a provided mapping.

This method maps each possible enum entry to a [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) using the provided `mapping`
function. At runtime, the resulting [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) will resolve to the value corresponding to
the current state of the enum.

#### Parameters

| | |
| --- | --- |
| mapping | A function that defines how each enum constant should be converted to a [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt). |

#### Returns

| | |
| --- | --- |
|  | A [RemoteInt](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteInt) that tracks the integer value associated with this enum. |

## Companion Object

#### Methods

> Source set: Android

```kotlin
public inline operator fun <reified T : Enum<T>> invoke(value: T): RemoteEnum<T>
```

Creates a [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) from a literal constant.

#### Parameters

| | |
| --- | --- |
| value | The constant `Enum` value. |

#### Returns

| | |
| --- | --- |
|  | A [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) representing the constant enum. |

> Source set: Android

```kotlin
@JvmStatic
public inline fun <reified T : Enum<T>> createNamedRemoteEnum(
    name: String,
    defaultValue: T,
    domain: RemoteState.Domain = RemoteState.Domain.User,
): RemoteEnum<T>
```

Creates a named [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) with an initial value.

#### Parameters

| | |
| --- | --- |
| name | The unique name for this remote enum. |
| domain | The domain of the named enum (defaults to [RemoteState.Domain.User](/jetpack-compose/androidx.compose.remote/remote-creation-compose/objects/RemoteState.Domain.User)). |
| defaultValue | The initial `Enum` value for the named remote enum. |

#### Returns

| | |
| --- | --- |
|  | A [RemoteEnum](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteEnum) representing the named enum. |
