# Network selector

<figure><img src="/files/6CZuAGFieSStmi8sYwk7" alt=""><figcaption><p>Network selector widget</p></figcaption></figure>

If your application can switch between Mainnet and Testnet networks you may want to add the network selector widget to the CSPR.click navigation bar.

## Network selector set up

Define an array with the list of networks your application supports:

```tsx
export const NETWORKS = ['Mainnet', 'Testnet'];
```

Create a state value to store the current network. For example, with `useState()` hook, but you can use any other method.

```tsx
const [network, setNetwork] = useState<string>(NETWORKS[1]);
```

Define a `networkSettings` object with the list of networks, the current network, and a callback method to handle network selection by the user. Add this object to the `topBarSettings` prop in the `<ClickUI>` component:

```typescript
const networkSettings = {
  networks: NETWORKS,
  currentNetwork: network,
  onNetworkSwitch: (n: string) => { setNetwork(n); },
}
```

```tsx
<ClickUI 
    topBarSettings={{
        networkSettings
    }}
/>
```

### Customize the network icons

You can also specify your custom icons for each of the networks:

```tsx
import mainnetIcon from './assets/ico-mainnet.svg'
import testnetIcon from './assets/ico-testnet.svg'

const NETWORKS = [
  { title: 'Mainnet', icon: mainnetIcon },
  { title: 'Testnet', icon: testnetIcon }
];
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cspr.click/cspr.click-v1.12/cspr.click-sdk/react/customizing-the-top-bar/network-selector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
