4 min readUpdated Mar 2, 2026

BaseModal Component Documentation

Overview

The BaseModal component is a versatile modal dialog UI element designed for the "Vantage" analytics and data platform. This component can be utilized to present information, gather user input, or display confirmations in a user-friendly manner, enhancing the user experience by providing a structure to overlay content without navigating away from the current page.

Purpose

The BaseModal serves as a container for other components, allowing developers to display various types of content within a modal dialog. This component is particularly useful for scenarios where a focused user interaction is required, such as user confirmations, alerts, or forms.

Settings

The BaseModal component accepts the following props:

Title

Children

OnClose

Size

ScrollBody

Variant

How It Works

The BaseModal component operates in the following manner:

  1. Rendering: It first generates the modal structure with specified title, children, and footer. The appropriate class for the modal size is assigned based on the size prop.

  2. Visual Styles: It applies styles conditionally, particularly for the header and the overall look based on the variant. The body content can either scroll or not based on the scrollBody prop, ensuring that users can access all content without losing focus on modal interaction.

  3. Closing Mechanism: The modal provides a close button that invokes the onClose callback function when clicked, allowing developers to implement specific functionalities upon modal closure.

Use Cases & Examples

Use Case 1: User Confirmation

A scenario where users are required to confirm their actions, such as deleting a file or submitting a form.

Use Case 2: Form Input

Displaying a form to gather information from the user, such as profile updates or feedback submission.

Example Configuration

Scenario

Let's say you want to create a user feedback submission modal. You'll allow users to enter their comments and rate their experience.

Configuration

javascript
<BaseModal
    title="Submit Your Feedback"
    onClose={() => console.log("Modal closed")}
    footer={
        <>
            <button className="btn btn-primary">Submit</button>
            <button className="btn btn-secondary" onClick={() => console.log("Cancelled")}>Cancel</button>
        </>
    }
    size="lg"
    scrollBody={true}
    variant="default"
>
    <div>
        <label htmlFor="feedback">Your Feedback:</label>
        <textarea id="feedback" rows="4" placeholder="Enter your comments here..."></textarea>
        <label htmlFor="rating">Rating:</label>
        <select id="rating">
            <option value="1">1 - Poor</option>
            <option value="2">2 - Fair</option>
            <option value="3">3 - Good</option>
            <option value="4">4 - Very Good</option>
            <option value="5">5 - Excellent</option>
        </select>
    </div>
</BaseModal>

In this configuration, the modal asks for user feedback with a scrollable body for entering comments and selecting a rating. The footer includes actionable buttons for submission and cancellation, linked to the respective functionalities.