Modal
An overlaying window to take focus away from the current context.
Basic Example
<script>
import { Modal, ModalBackdrop, ModalContent, ModalDescription, ModalTitle, ModalTrigger } from 'lithesome';
</script>
<Modal>
<ModalTrigger>Click me</ModalTrigger>
<ModalBackdrop />
<ModalContent>
<ModalTitle>Modal Title</ModalTitle>
<ModalDescription>Modal Description</ModalDescription>
</ModalContent>
</Modal>
API Reference
<Modal />
| Property | Type | Description |
|---|---|---|
closeOnBackdropClick | boolean | Allows the backdrop to close the modal if the user clicks on it. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
| State | Type | Description |
|---|---|---|
visible | boolean | True if the contents are visible. |
<ModalTrigger />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
visible | boolean | True if the contents are visible. |
<ModalBackdrop />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
visible | boolean | True if the contents are visible. |
<ModalContent />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
visible | boolean | True if the contents are visible. |
<ModalTitle />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
<ModalDescription />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |