> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# bucketAttribute()

- Package: [@gooddata/sdk-model](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-model/src/execution/buckets/index.ts

Gets first attribute matching the provided predicate from the bucket.

**Signature:**

```typescript
export declare function bucketAttribute(bucket: IBucket, idOrFun?: string | AttributePredicate): IAttribute | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| bucket | [IBucket](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.ibucket/index.md) | bucket to to search in |
| idOrFun | string \| [AttributePredicate](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.attributepredicate/index.md) | _(Optional)_ attribute identifier or instance of AttributePredicate; [anyAttribute](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.anyattribute/index.md) predicate is default |

**Returns:**

[IAttribute](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iattribute/index.md) &#124; undefined

undefined if no matching attribute is found

## Remarks

If no predicate is provided, then the function defaults to anyAttribute predicate - meaning first found attribute will be returned.

This function also provides convenience to find attribute by its local identifier - if you pass predicate as string the function will automatically create idMatchAttribute predicate.
