Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions main/guides/UIComponentLibrary/UIComponentsstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

You'll find a collection of ready-to-use or pre-coded user interface elements that help accelerate your Agoric Dapp-building. These pre-designed elements include wallet connect buttons, chain selector, node selector, amount input and wallet provisioning.
Utilization of these building blocks ensures best practices in design and accessibility.

## Installation and Setup

See [Introduction to Agoric UI Kit](https://a0a31cba.documentation-7tp.pages.dev/guides/getting-started/how-to-use-ui-kit#introduction-to-agoric-ui-kit) for installation and setup how-to.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably shouldn't link to a CI rendering.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite:

use relative links instead of absolute ones for any links to files or folders in the Documentation repo
-- [Writing Links in CONTRIBUTING]


Once complete you'll need to run this yarn command:

```sh
yarn add @agoric/react-components
```

## UI Components List

Before getting started, there are some resources you might want to keep handy in case you get stuck, have questions, or are curious about any of the components. Getting in contact with us is easy!

- Connect Wallet
- Wallet Provisioning
- Amount Input
- Chain Selector
- Node Selector

## Connect Wallet

<img style="border: 2px solid grey"
alt="Screenshot: Connect Wallet"
src="./assets/connectwallet.png" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RollupError: Could not resolve "./assets/connectwallet.png" from "main/guides/UIComponentLibrary/UIComponentsstart.md"

The assets directory is one level up, but does not contain a connectwallet.png file. Maybe it should be this?

Suggested change
src="./assets/connectwallet.png" />
src="../assets/5-ConnectWalletUI.png" />

(and likewise for the other <img>s)


<img style="border: 2px solid grey"
alt="Screenshot: Wallet Address"
src="./assets/walletaddress.png" />

<img style="border: 2px solid grey"
alt="Screenshot: Select Wallet"
src="./assets/selectwallet.png" />

- [Connecting with Wallet Connect Button](https://github.com/Agoric/ui-kit/tree/main/packages/react-components#integrating)
- [Connecting without Wallet Connect Button](https://github.com/Agoric/ui-kit/tree/main/packages/react-components#connecting-without-connectwalletbutton)
- [Using a Custom Chain Provider](https://github.com/Agoric/ui-kit/tree/main/packages/react-components#connecting-without-connectwalletbutton)

Customizable Parameters
| Parameter | Type | Description |
|----------|----------|----------|
| ClassName | string | CSS class name for the underlying <button> element |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| ClassName | string | CSS class name for the underlying <button> element |
| ClassName | string | CSS class name for the underlying \<button> element |


## Wallet Provisioning

<img style="border: 2px solid grey"
alt="Screenshot: Wallet provision"
src="./assets/walletprovision.png" />

See `AgoricProviderLite` component -> `provisionNoticeContent` prop:

Customizable Parameters
| Parameter | Type | Description |
|----------|----------|----------|
| provisionNoticeContent | undefined | (fee?: bigint) => JSX.Element | The main content to show in the provision notice dialog (default shown in screenshot) |

### Amount Input

<img style="border: 2px solid grey"
alt="Screenshot: Amount Input"
src="./assets/amountinput.png" />

Customizable Parameters
| Parameter | Type | Description |
|----------|----------|----------|
| value | bigint | null | The current value of the input |
| decimalPlace | number | The number of decimal places used for displaying the denominated value |
| className | string | undefined | CSS class name for the underlying <input> element |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| className | string | undefined | CSS class name for the underlying <input> element |
| className | string | undefined | CSS class name for the underlying \<input> element |

| onChange | undefined | (value: bigint) => void | Callback for handling input changes |
| disabled | boolean | undefined | Whether or not the input is disabled. Defaults to false. |

## Chain Selector

<img style="border: 2px solid grey"
alt="Screenshot: Chain Selector"
src="./assets/chainselector.png" />

<img style="border: 2px solid grey"
alt="Screenshot: Chain Selector 2"
src="./assets/chainselector2.png" />

- [Network Dropdown](https://github.com/Agoric/ui-kit/tree/main/packages/react-components#network-dropdown)

Customizable Parameters
| Parameter | Type | Description |
|----------|----------|----------|
| networkConfigs | NetworkConfig[] | The list of Agoric network configs to choose from. |
| label | ChangeChainCombobox[‘label’] | See [ChangeChainCombobox](https://storybook.cosmology.zone/?path=/docs/swap-changechaincombobox--docs) |
| size | ChangeChainCombobox[‘size’] | See [ChangeChainCombobox](https://storybook.cosmology.zone/?path=/docs/swap-changechaincombobox--docs) |
| appearance | ChangeChainCombobox[‘appearance’] | See [ChangeChainCombobox](https://storybook.cosmology.zone/?path=/docs/swap-changechaincombobox--docs) |
| maxHeight | ChangeChainCombobox[‘maxHeight’] | See [ChangeChainCombobox](https://storybook.cosmology.zone/?path=/docs/swap-changechaincombobox--docs) |

## Node Selector

<img style="border: 2px solid grey"
alt="Screenshot: node selector"
src="./assets/nodeselector.png" />

- [Node Selector](https://github.com/Agoric/ui-kit/tree/main/packages/react-components#node-selector)

Customizable Parameters
| Parameter | Type | Description |
|----------|----------|----------|
| isOpen | boolean | undefined | Whether or not the modal is open |
| onClose | () => void | Triggered when the user tries to close the modal |