Cosmos Components include some modals out of the box.
modals
object’s methods:
cosmos-modal-base
component with your own custom element, ormodals
object.cosmos-modal-base
componentcosmos-modal-base
component with your own custom element.
cosmos-modal-base
and customize them to your liking.
There are currently 2 modals in the library:
cosmos-modal-wallet
- A modal for selecting & connecting a wallet.cosmos-modal-error
- A modal for displaying an error to the user.Error
instances, etc.
You can also define your own formatters:
undefined
, it will be ignored. If no formatter returns a value,
the modal will display the JSON-stringified error.
The expected return value is either a string or an HTMLElement
. You can use a frontend framework
like React, Preact, or Vue to render your error message, however, you will need to render it into
an HTMLElement
and handle cleanup when the modal is remove
d. Refer to
Creating Custom Elements for more information.
modals
methodsmodals
object allows you
to replace the methods with your own custom ones. This allows you to integrate the Cosmos Components
with your own frontend framework.
Unlike Toasts, Modals are more specialized for specific use cases & data: