1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/ui/components/component-library/picker-network/README.mdx
Dhruv 658ceb90d1
Fix-Migrate Picker-Network to TS (#20365)
* migrating PickerNetwork to TS

* deleting js file

* deleting js snapshot

* fixing e2e tests and updating snapshot

* updating snapshot

* Some small updates to docs and types

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: Garrett Bear <gwhisten@gmail.com>
2023-08-04 10:11:55 -07:00

47 lines
1.3 KiB
Plaintext

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { PickerNetwork } from './picker-network';
# PickerNetwork
The `PickerNetwork` is used for the action of changing a network.
<Canvas>
<Story id="components-componentlibrary-pickernetwork--default-story" />
</Canvas>
## Props
<ArgsTable of={PickerNetwork} />
### Label
Use the `label` prop for the text content of the `PickerNetwork` component. For long labels set a `max-width` using a `className` and the text will truncate showing an ellipsis.
<Canvas>
<Story id="components-componentlibrary-pickernetwork--label" />
</Canvas>
```jsx
import { PickerNetwork } from '../../ui/component-library';
<PickerNetwork label="Arbitrum One" />
<PickerNetwork label="Polygon Mainnet" />
<PickerNetwork label="Optimism" />
<PickerNetwork label="BNB Smart Chain (previously Binance Smart Chain Mainnet)" style={{ maxWidth: '200px' }} />
```
### Src
Use the `src` prop with an image url to render the `AvatarNetwork`. Use the `avatarNetworkProps` to pass additional props to the `AvatarNetwork` component.
<Canvas>
<Story id="components-componentlibrary-pickernetwork--src" />
</Canvas>
```jsx
import { PickerNetwork } from '../../ui/component-library';
<PickerNetwork src="./images/arbitrum.svg" />
<PickerNetwork src="./images/matic-token.png" />
<PickerNetwork src="./images/optimism.svg" />
```