# OutlinedCompactChip

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material/OutlinedCompactChip.composable#OutlinedCompactChip(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material.ChipColors,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material.ChipBorder)( onClick: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, label: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/RowScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, icon: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/BoxScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipColors, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource?, contentPadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues, shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, border: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipBorder )` A compact Outlined Wear Material Chip that offers two slots and a specific layout for an icon and label. |

## Functions

### OutlinedCompactChip

Artifact: [androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/Chip.kt+function:OutlinedCompactChip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.1.0)

```
@Composable
fun OutlinedCompactChip(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    label: (@Composable RowScope.() -> Unit)? = null,
    icon: (@Composable BoxScope.() -> Unit)? = null,
    colors: ChipColors = ChipDefaults.outlinedChipColors(),
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    contentPadding: PaddingValues = ChipDefaults.CompactChipContentPadding,
    shape: Shape = MaterialTheme.shapes.large,
    border: ChipBorder = ChipDefaults.outlinedChipBorder()
): Unit
```

A compact Outlined Wear Material Chip that offers two slots and a specific layout for an icon and label. Both the icon and label are optional however it is expected that at least one will be provided.

The `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/CompactChip.composable#CompactChip(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material.ChipColors,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material.ChipBorder)` is Stadium shaped and has a max height designed to take no more than one line of text and/or one icon. The default max height is `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#CompactChipHeight()`. This includes a visible chip height of 32.dp and 8.dp of padding above and below the chip in order to meet accessibility guidelines that request a minimum of 48.dp height and width of tappable area.

If an icon is provided then the labels should be "start" aligned, e.g. left aligned in ltr so that the text starts next to the icon.

The items are laid out as follows.

1. If a label is provided then the chip will be laid out with the optional icon at the start of a row followed by the label with a default max height of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#CompactChipHeight()`.

2. If only an icon is provided it will be laid out vertically and horizontally centered with a default height of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#CompactChipHeight()` and the default width of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#IconOnlyCompactChipWidth()`

If neither icon nor label is provided then the chip will be displayed like an icon only chip but with no contents and ChipColors.background() color.

the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/OutlinedCompactChip.composable#OutlinedCompactChip(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material.ChipColors,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material.ChipBorder)` has a transparent background, a thin border and contents which are colored with the theme primary color. Colors can be obtained and customized using ChipDefaults.outlinedChipColors().

Chips can be enabled or disabled. A disabled chip will not respond to click events.

Example of a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/OutlinedCompactChip.composable#OutlinedCompactChip(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material.ChipColors,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material.ChipBorder)` with icon and single line of label text:

```kotlin
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.CompactChip
import androidx.wear.compose.material.Icon
import androidx.wear.compose.material.OutlinedCompactChip
import androidx.wear.compose.material.Text

OutlinedCompactChip(
    onClick = { /* Do something */ },
    enabled = true,
    // CompactChip label should be no more than 1 line of text
    label = { Text("Single line label", maxLines = 1, overflow = TextOverflow.Ellipsis) },
    icon = {
        Icon(
            painter = painterResource(id = R.drawable.ic_airplanemode_active_24px),
            contentDescription = "airplane",
            modifier = Modifier.size(ChipDefaults.SmallIconSize),
        )
    },
)
```

For more information, see the [Chips](https://developer.android.com/training/wearables/components/chips) guide.

| Parameters |
|---|---|
| `onClick: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Will be called when the user clicks the chip |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | Modifier to be applied to the chip |
| `label: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/RowScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | A slot for providing the chip's main label. The contents are expected to be text which is "start" aligned if there is an icon present and "center" aligned if not. |
| `icon: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/BoxScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | A slot for providing the chip's icon. The contents are expected to be a horizontally and vertically aligned icon of size `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#SmallIconSize()` when used with a label or `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#IconSize()` when used as the only content in the CompactChip. In order to correctly render when the Chip is not enabled the icon must set its alpha value to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#LocalContentAlpha()`. |
| `colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipColors = ChipDefaults.outlinedChipColors()` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipColors` that will be used to resolve the background and content color for this chip in different states. See `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#outlinedChipColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`. Defaults to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#primaryChipColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Controls the enabled state of the chip. When `false`, this chip will not be clickable |
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource? = null` | an optional hoisted `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource` for observing and emitting `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/Interaction`s for this chip. You can use this to change the chip's appearance or preview the chip in different states. Note that if `null` is provided, interactions will still happen internally. |
| `contentPadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues = ChipDefaults.CompactChipContentPadding` | The spacing values to apply internally between the container and the content |
| `shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape = MaterialTheme.shapes.large` | Defines the chip's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
| `border: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipBorder = ChipDefaults.outlinedChipBorder()` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipBorder` that will be used to resolve the border for this chip in different states. See `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ChipDefaults#outlinedChipBorder(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp)`. |