Skip to Content
Logo of RG Logo of RG
  • Home
  • Shop
  • Events
  • Courses
  • Company
    • News
    • Success Stories
  • Odoo Docs 19
  • Appointment
  • Jobs
  • Contact us
  • 0
  • 0
  • +1 555-555-5556
  • Sign in
Logo of RG Logo of RG
  • 0
  • 0
    • Home
    • Shop
    • Events
    • Courses
    • Company
      • News
      • Success Stories
    • Odoo Docs 19
    • Appointment
    • Jobs
    • Contact us
  • +1 555-555-5556
  • Sign in
Odoo Docs 19
Home Components Guides Classes Search
418 components
Overlay
  • Accordion Item
  • Barcode Dialog
  • Bottom Sheet
  • Calendar Common Popover
  • Calendar Year Popover
  • Confirmation Dialog
  • Date Time Picker Popover
  • dialog
  • Domain Selector Dialog
  • Dropdown
  • Dropdown Group
  • Dropdown Item
  • Dropdown Popover
  • Error504 Dialog
  • Error Dialog
  • Export Data Dialog
  • Expression Editor Dialog
  • Form Error Dialog
  • Form View Dialog
  • Kanban Column Examples Dialog
  • Kanban Cover Image Dialog
  • Kanban Dropdown Menu Wrapper
  • List Confirmation Dialog
  • Model Field Selector Popover
  • Multi Create Popover
  • Multi Currency Popover
  • popover
  • Redirect Warning Dialog
  • Res User Group Ids Popover
  • Scss Error Display
  • Select Create
  • Select Create Dialog
  • Session Expired Dialog
  • Signature Dialog
  • Warning Dialog
  1. Components
  2. Bottom Sheet
services overlay

Bottom Sheet

Odoo 19 services — Bottom Sheet (core)

Live preview Interactive
Source excerpt web/static/src/core/bottom_sheet/bottom_sheet_service.js
import { markRaw } from "@odoo/owl";
import { BottomSheet } from "@web/core/bottom_sheet/bottom_sheet";
import { registry } from "@web/core/registry";

/**
 * @typedef {{
 *   env?: object;
 *   onClose?: () => void;
 *   class?: string;
 *   role?: string;
 *   ref?: Function;
 *   useBottomSheet?: Boolean;
 * }} PopoverServiceAddOptions
 *
 * @typedef {ReturnType<popoverService["start"]>["add"]} PopoverServiceAddFunction
 */

export const popoverService = {
    dependencies: ["overlay"],
    start(_, { overlay }) {
        let bottomSheetCount = 0;
        /**
         * Signals the manager to add a popover.
         *
         * @param {HTMLElement} target
         * @param {typeof import("@odoo/owl").Component} component
         * @param {object} [props]
         * @param {PopoverServiceAddOptions} [options]
         * @returns {() => void}
         */
        const add = (target, component, props = {}, options = {}) => {
            function removeAndUpdateCount() {
                _remove();
                bottomSheetCount--;
                if (bottomSheetCount === 0) {
                    document.body.classList.remove("bottom-sheet-open");
                } else if (bottomSheetCount === 1) {
                    document.body.classList.remove("bottom-sheet-open-multiple");
                }
            }
            const _remove = overlay.add(
                BottomSheet,
                {
                    close: removeAndUpdateCount,
                    component,
                    componentProps: markRaw(props),
                    ref: options.ref,
                    class: options.class,
                    role: options.role,
                },
                {
                    env: options.env,
                    onRemove: options.onClose,
                    rootId: target.getRootNode()?.host?.id,
                }
            );
            bottomSheetCount++;
            if (bottomSheetCount === 1) {
                document.body.classList.add("bottom-sheet-open");
            } else if (bottomSheetCount > 1) {
                document.body.classList.add("bottom-sheet-open-multiple");
            }

            return removeAndUpdateCount;
        };

        return { add };
    },
};

registry.category("services").add("bottom_sheet", popoverService);
Registry / API
Registry name
bottom_sheet
Category
services
Module
web
Slug
bottom-sheet
Nav group
overlay
Follow us

250 Executive Park Blvd, Suite 3400
San Francisco CA 94134

  • +1 555-555-5556
  • info@yourcompany.example.com
Copyright © Company name
Powered by Odoo - The #1 Open Source eCommerce