# ModifiersBuilders.Clickable.Builder

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/ModifiersBuilders.java+class:androidx.wear.protolayout.ModifiersBuilders.Clickable.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
public final class ModifiersBuilders.Clickable.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable`

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#Builder()()` Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder`. |
| `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 600) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#Builder(androidx.wear.protolayout.ProtoLayoutScope,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ProtoLayoutScope scope, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html clickableId)` Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` which is able to accept a `https://developer.android.com/reference/android/app/PendingIntent.html` as onClick action. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#build()()` Builds an instance from accumulated values. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setId(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id)` Sets the ID associated with this action. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 300) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setMinimumClickableHeight(androidx.wear.protolayout.DimensionBuilders.DpProp)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.DpProp minimumClickableHeight )` Sets the minimum height of the clickable area. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 300) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setMinimumClickableWidth(androidx.wear.protolayout.DimensionBuilders.DpProp)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.DpProp minimumClickableWidth )` Sets the minimum width of the clickable area. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setOnClick(androidx.wear.protolayout.ActionBuilders.Action)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ActionBuilders.Action onClick)` Sets the action to perform when the element this modifier is attached to is clicked. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 600) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setOnClick(android.app.PendingIntent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent)` Sets the `https://developer.android.com/reference/android/app/PendingIntent.html` to perform when the element this modifier is attached to is clicked. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 400) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setVisualFeedbackEnabled(boolean)(boolean visualFeedbackEnabled)` Sets whether the click visual feedback (such as a ripple) should be enabled. |

## Public constructors

### Builder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public Builder()
```

Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder`.

Note that, builder created with this constructor can not be used to invoke `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#setOnClick(android.app.PendingIntent)`, otherwise an exception will be thrown. Instead, create the builder with `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#Builder(androidx.wear.protolayout.ProtoLayoutScope,java.lang.String)` for setting a `https://developer.android.com/reference/android/app/PendingIntent.html` as onClick action.

### Builder

Added in [1.4.2](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.4.2)

```
@RequiresSchemaVersion(major = 1, minor = 600)
public Builder(@NonNull ProtoLayoutScope scope, @NonNull String clickableId)
```

Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder` which is able to accept a `https://developer.android.com/reference/android/app/PendingIntent.html` as onClick action. Builder instance created with this constructor works with other type of actions as well.

Note that, calling `#setId` would override the clickable Id set here.

## Public methods

### build

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @NonNull ModifiersBuilders.Clickable build()
```

Builds an instance from accumulated values.

### setId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull ModifiersBuilders.Clickable.Builder setId(@NonNull String id)
```

Sets the ID associated with this action.

### setMinimumClickableHeight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)

```
@RequiresSchemaVersion(major = 1, minor = 300)
public @NonNull ModifiersBuilders.Clickable.Builder setMinimumClickableHeight(
    @NonNull DimensionBuilders.DpProp minimumClickableHeight
)
```

Sets the minimum height of the clickable area.

The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable height is not guaranteed unless there is enough space around the element within its parent bounds.

Note that this field only supports static values.

### setMinimumClickableWidth

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)

```
@RequiresSchemaVersion(major = 1, minor = 300)
public @NonNull ModifiersBuilders.Clickable.Builder setMinimumClickableWidth(
    @NonNull DimensionBuilders.DpProp minimumClickableWidth
)
```

Sets the minimum width of the clickable area.

The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width is not guaranteed unless there is enough space around the element within its parent bounds.

Note that this field only supports static values.

### setOnClick

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull ModifiersBuilders.Clickable.Builder setOnClick(@NonNull ActionBuilders.Action onClick)
```

Sets the action to perform when the element this modifier is attached to is clicked.

### setOnClick

Added in [1.4.2](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.4.2)

```
@RequiresSchemaVersion(major = 1, minor = 600)
public @NonNull ModifiersBuilders.Clickable.Builder setOnClick(@NonNull PendingIntent pendingIntent)
```

Sets the `https://developer.android.com/reference/android/app/PendingIntent.html` to perform when the element this modifier is attached to is clicked.

Note that this method is mutually exclusive with `#setOnClick(Action)`, the later method call will override the previous one.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the builder is not constructed with `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Clickable.Builder#Builder(androidx.wear.protolayout.ProtoLayoutScope,java.lang.String)`. |

### setVisualFeedbackEnabled

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)

```
@RequiresSchemaVersion(major = 1, minor = 400)
public @NonNull ModifiersBuilders.Clickable.Builder setVisualFeedbackEnabled(boolean visualFeedbackEnabled)
```

Sets whether the click visual feedback (such as a ripple) should be enabled. Defaults to true.