---
title: "FlexBasis"
description: "Defines the initial main size of a flex item before free space distribution.
- [Auto]: Uses the item's explicitly set size, or falls back to its natural content size.
- [Dp]: Uses a fixed exact size in [androidx.compose.ui.unit.Dp].
- [Percent]: Uses a fraction of the container's main axis size."
type: "class"
---

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


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

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


```kotlin
@ExperimentalFlexBoxApi
value class FlexBasis
@PublishedApi
internal constructor(@PublishedApi internal val packedValue: Long)
```


Defines the initial main size of a flex item before free space distribution.
- `Auto`: Uses the item's explicitly set size, or falls back to its natural content size.
- `Dp`: Uses a fixed exact size in `androidx.compose.ui.unit.Dp`.
- `Percent`: Uses a fraction of the container's main axis size.


## Companion Object

#### Properties

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


```kotlin
val Auto = FlexBasis(TypeAuto shl TypeShift)
```


Use the item's maximum intrinsic size as the basis.

If the item has an explicitly set size modifier along the main axis (for example,
`Modifier.width` in a `FlexDirection.Row`), that exact size will be used as the basis.
Otherwise, it falls back to measuring the item's preferred natural content size without
constraints.

This is the default value.



#### Methods

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


```kotlin
fun Dp(value: Dp): FlexBasis
```


Use a fixed size in `androidx.compose.ui.unit.Dp` as the basis.

#### Parameters

| | |
| --- | --- |
| value | The basis size in Dp. |




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


```kotlin
fun Percent(@FloatRange(0.0, 1.0) value: Float): FlexBasis
```


Use a fraction of the container's main axis size as the basis.

#### Parameters

| | |
| --- | --- |
| value | A value between 0.0 and 1.0 representing the percentage. |






