> ## Documentation Index
> Fetch the complete documentation index at: https://docs.towns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useSetUsername

Hook to set the username of the current user in a stream.

## Imports

```ts theme={null}
import { useSetUsername } from '@towns-protocol/react-sdk'
```

## Definition

```ts theme={null}
function useSetUsername(
  streamId: string,
  config?: ActionConfig<Myself["setUsername"]>,
): {
    data: void | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    setUsername: (username: string) => Promise<void>;
}
```

**Source:** [useSetUsername](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useMyMember.ts)

## Parameters

### streamId

* **Type:** `string`

The id of the stream to set the username of.

### config

* **Type:** `ActionConfig<Myself["setUsername"]>`
* **Optional**

Configuration options for the action.

## Return Type

The `setUsername` action and its loading state.

```ts theme={null}
{
    data: void | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    setUsername: (username: string) => Promise<void>;
}
```
