Immersive Elevation Modal Framework

In my Bootstrap modal, I have a plethora of content, such as:

https://i.sstatic.net/o6lm4.png

However, the bottom of the modal is experiencing an overflow of height like so:

https://i.sstatic.net/qlKrl.png

I've attempted utilizing the max-height property on the modal and overflow on the modal body, but no success has been achieved.

Here is the code snippet:

const ModalsPreviewHTKP = ({ show, onHide, defaultValues }) => {
  const resData = defaultValues?.id;

  return (
        <Modal show={show}>
            <Modal.Header className='txt-blue-grey-700 text-bold header-md'>
                <span className='mx-auto'>PRATINJAU HTKP</span>
                <button type="button" class="btn-close m-0 p-0" aria-label="Close" onClick={onHide}></button>
            </Modal.Header>
            <Modal.Body>
              <div className='d-flex gap-2 mb-3 justify-content-center'>
                <img src={iconCard} alt="icon rumah sakit"/>
                <div style={{ lineHeight: '1.5em' }}>
                  <p>RS KASIH IBU BANDUNG</p>
                  <p>Jl. Cibolerang No. 23 Bandung 40225 <br/>
                    Telp: 022-8876-4532, Fax: (022)</p>
                </div>
              </div>

              <Table bordered>
                <tr>
                  <th>Nama Pasien</th>
                  <td>Udin Solehatun</td>
                </tr>
                <tr>
                  <th>Nama Dokter</th>
                  <td>Ahmad Pratama</td>
                </tr>
                 // More code here...
                  <tr>
                    <td colSpan={2}>
                      <Table style={{ border: '1px solid black', textAlign: 'center' }}>
                        <thead style={{ backgroundColor: '#ECEFF1', border: '1px solid black' }}>
                          <th style={{ width: '25%' }}>H</th>
                          <th style={{ width: '25%' }}>T</th>
                          <th style={{ width: '25%' }}>K</th>
                          <th style={{ width: '25%' }}>P</th>
                        </thead>
                        {/* <tbody>
                        
                        </tbody> */}
                      </Table>
                    </td>
                </tr>
              </Table>
              <ButtonSecondary variant="solid">CETAK RESEP <FaPrint color='white'/> </ButtonSecondary>
            </Modal.Body>
        </Modal>
  )
}

What is the recommended approach/solution to address this issue?

Any assistance would be greatly valued. Thank you.

Answer №1

When using React Bootstrap, simply include the scrollable property in your <Modal> component like this:

  • Before: <Modal show={show}>
  • After:
    <Modal show={show} scrollable>

For the example below, basic HTML is used to demonstrate the functionality:

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e3818c8c979097918293a3d6cdd1cdd0">[email protected]</a>/dist/css/bootstrap.min.css"
  integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
  crossorigin="anonymous"
/>

<div class="modal show" style="display: block;">
  <div class="modal-dialog modal-dialog-scrollable">
    <div class="modal-content">
      <div class="modal-header text-blue-grey-700 text-bold header-md">
        <span className="mx-auto">PREVIEW HTKP</span>
        <button
          type="button"
          class="btn-close m-0 p-0"
          aria-label="Close"
        ></button>
      </div>
      <div class="modal-body">
        <div class="d-flex gap-2 mb-3 justify-content-center">
          <img src="https://placekitten.com/200/200" alt="hospital icon" />
          <div style="line-height: 1.5em">
            <p>MOTHER'S LOVE HOSPITAL BANDUNG</p>
            <p>
              Jl. Cibolerang No. 23 Bandung 40225 <br />
              Phone: 022-8876-4532, Fax: (022)
            </p>
          </div>
        </div>
        <table class="table table-bordered">
          <tr>
            <th>Patient's Name</th>
            <td>Udin Solehatun</td>
          </tr>
          <tr>
            <th>Doctor's Name</th>
            <td>Ahmad Pratama</td>
          </tr>
          <tr>
            <th>Prescription Date</th>
            <td>07-05-2021, 16:30 WIB</td>
          </tr>
          <tr>
            <th>Doctor's Prescription No.</th>
            <td>10/RI</td>
          </tr>
          <tr>
            <th>Unit</th>
            <td>Delivery Room (VK)</td>
          </tr>
          <tr>
            <th>Client</th>
            <td>Public</td>
          </tr>
          <tr className="border-0">
            <td>
              <div className="d-flex flex-column" style="line-height: 1.5">
                <span>Abbotic 125 Mg 30 Ml Syrup</span>
                <span>1x1 Tab After Meals (Finish)</span>
              </div>
            </td>
            <td>No. 1</td>
          </tr>
          <tr>
            <td colspan="2">
              <table
                class="table"
                style="border: 1px solid black; text-align: center"
              >
                <thead
                  style="background-color: #eceff1; border: 1px solid black"
                >
                  <th style="width: 25%">H</th>
                  <th style="width: 25%">T</th>
                  <th style="width: 25%">K</th>
                  <th style="width: 25%">P</th>
                </thead>
              </table>
            </td>
          </tr>
        </table>
        <button type="button" class="btn btn-secondary">PRINT PRESCRIPTION</button>
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Steps to gather all the images within a directory

Take a look at this demo When you click on the "next" button, new images are loaded from the internet. In my application, all the images are stored in the img/image folder with names like 1.jpg, hi.png, etc. My question is, how can I display these image ...

swapping out an external CSS file in React for a new CSS file

My React app is quite large and includes four main CSS files (darkLTR, lightLTR, darkRTL, lightRTL), which may not be the most efficient setup. The templates were provided by my boss, and I was instructed to use them instead of Material UI, which I initial ...

Unlocking the power of translation in React: Implementing Amazon Translate or Google Translate for AXIOS responses

I'm currently working on converting Axios JSON responses in React. Here is the code snippet: axios.get('https://jsonplaceholder.typicode.com/users') .then(res => { ...translation_logic_here setU ...

Achieving a layout of three columns and two rows (1 x 2 x 2) using flexbox

I am looking to achieve a specific layout using Flexbox. While I am comfortable with CSS, I want to challenge myself by learning how to implement this design using Flexbox for more concise and maintainable code. https://i.stack.imgur.com/QDVfT.png .ban ...

Issue encountered when converting ES6 JSX code to JavaScript React format

I am currently working on a project using React. Below is the code snippet I have: index.js var Btn = require('./components/Btn.jsx'); var app = { // Application Constructor initialize: function() { console.lo ...

Experiencing difficulties installing ReactJS on Windows 10 with error messages popping up

Hi there, I'm new to ReactJS and trying to set it up on Windows 10. However, when I try to install React, I encounter the following error: npm ERR! Windows_NT 10.0.10240 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\P ...

Customizing color schemes of bootstrap buttons and dropdown-toggle elements

My button group looks like this: HTML <div class="btn-group"> <button type="button" class="btn btn-default btn-xs red-outline-button"> Sync </button> <button type="button" class="btn btn-default btn-xs gold-outline-button" da ...

What causes the cursor in an editable div to automatically move to the front of the div?

<div className="min-w-[600px] min-h-[36.8px]" > <div id={`editableDiv-${Object.keys(item)}-${index}`} className="p-3" contentEditable suppressContentEditableWarning onInput={(e) => onChange(e)} > ...

Apply the jQuery method to select elements with index 3, 4, 5, 6, or 7, then add

My current Wordpress blog displays 20 posts. I am looking to apply a specific class to posts numbered 2 through 10, and then again from 12 to 20. I do not want the first post or post number 11 to have this class added. I attempted using CSS selectors lik ...

The Div element on my webpage is not adjusting properly to fit the size of mobile devices

My app was created using Quick flip 2, and I needed to resize it for mobile screens, so I implemented jquery-mobile. Here is the code snippet: <!--css--> <style> .quickFlip, .quickFlip3 { height: 350px; width: 400px; } .quickFlip2 { ...

How to send a dynamic URL parameter to a function in Next.js TypeScript without using implicit typing

When utilizing the useRouter function with a parameter of type string, the following error is encountered: Type 'string | string[] | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type & ...

Adjust the dimensions of the dropdown menus

I've set up 2 dropdown menus, but I'm having trouble adjusting their size. I need them to fill the screen width. Here's my code: <select id="repeatSelect" ng-model="selectedArea"> <option ng-repeat="(key,prop) in result" value=" ...

React component not displaying dynamic content when extending from a class

Hey guys, I'm a newbie when it comes to React and I've encountered a problem with loading content fetched from an API. Usually, I use export default function About({ posts }) which works like a charm in loading my content. However, for one specif ...

When Safari injects elements that were previously hidden with display:none, they remain visible

Using the JS library MagnificPopup, I implement popups on my website triggered by a "read more" button. This library moves the html to display it in a different location and then injects it back when the popup is closed. While this functionality works seam ...

Having trouble with images not showing up on React applications built with webpack?

Hey there! I decided not to use the create react app command and instead built everything from scratch. Below is my webpack configuration: const path = require("path"); module.exports = { mode: "development", entry: "./index.js", output: { pa ...

Tips on adding JSX to Storybook controls

While using Storybook, I want to navigate to my component and test the behavior of the Docs tab by changing control values for each property. I have implemented a component called Footer that can accept types such as string | JSX.Element | React.FunctionCo ...

Expand the div to fit 100% width inside the Blueprint container

I am currently working on a website and considering using the Blueprint CSS framework. You can view the site I'm referencing here: http://jsfiddle.net/timkl/uaSe3/ The Blueprint framework allows for a nice 24 column grid layout. One challenge I&apos ...

Issue with Photoswipe pswp class Not Getting Properly Cleared Upon Closing Image

My website has a Photoswipe image gallery from . The issue I'm facing is that the CSS class does not reset or clear after closing the gallery for the second time. For example, when a user opens item 1, the images are loaded into the picture div via A ...

Ran into a pair of kids sharing the same key - result in duplicate items

I have a multi-language page in NextJS and I want to implement language selection through a dropdown menu. const languages = [ { locales: 'fa', name: 'فارسی', country_code: 'ir' }, { locales: 'e ...