---
title: "MediaType"
description: "Type identifier for contents that are transferable between applications or processes. Although
mime type format was standardized, each platform is free to choose how they define media types.
Therefore, this class has an expect modifier for different platforms to specify how they define
certain common media types like Text, and Image."
type: "class"
---

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


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@ExperimentalFoundationApi
expect class MediaType(representation: String)
```


Type identifier for contents that are transferable between applications or processes. Although
mime type format was standardized, each platform is free to choose how they define media types.
Therefore, this class has an expect modifier for different platforms to specify how they define
certain common media types like Text, and Image.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val representation: String
```


How this `MediaType` is represented in a specific platform.



## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Text: MediaType
```


Any type of text, html, stylized, or plain.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val PlainText: MediaType
```


Plain text that's only decoded from its raw representation, does not define or carry any
annotations.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val HtmlText: MediaType
```


Text that represents an HTML content.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Image: MediaType
```


Any type of image like PNG, JPEG, or GIFs.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val All: MediaType
```


Matches all content types.




<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual class MediaType actual constructor(actual val representation: String)
```


Definition of common MediaTypes on the Android platform.

#### Parameters

| | |
| --- | --- |
| representation | MimeType string that conforms to RFC 2045. |



## Companion Object

#### Properties

<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val Text: MediaType
```


<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val PlainText: MediaType
```


<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val HtmlText: MediaType
```


<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val Image: MediaType
```


<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val All: MediaType
```




