---
title: useModal
description: 'A composable to programmatically control a Modal component.'
---
## Usage
Use the auto-imported `useModal` composable to programmatically control a [Modal](/components/modal) component.
```vue
```
- The `useModal` composable is created using `createSharedComposable`, ensuring that the same modal state is shared across your entire application.
::tip{to="/components/modal"}
Learn how to customize the appearance and behavior of modals in the **Modal** component documentation.
::
## API
### `open(component: Component, props?: ModalProps & ComponentProps)`
Opens a modal with the specified component and props.
- Parameters:
- `component`: The Vue component to render inside the modal.
- `props`: An optional object of props to pass to both the Modal and the rendered component.
```vue
```
### `close()`
Closes the currently open modal.
```vue
```
### `reset()`
Resets the modal state to its default values.
```vue
```
### `patch(props: Partial>)`
Updates the props of the currently open modal.
```vue
```
## Example
Here's a complete example of how to use the `useModal` composable:
```vue
```
In this example, we're using the `useModal` composable to control a modal. We can open it with a specific component and props, close it, and update its props.