How to make dialog2 resizable dynamically

Chien-Hao Chen December 14, 2017

Hi, I want to make my dialog2 be resizable like html tag textarea

so I added the Style as the following on dialog2:

<button id="dialog-show-button" class="aui-button">show</button>

<section id="demo-dialog" class="aui-dialog2 aui-dialog2-small aui-layer" role="dialog" aria-hidden="true" style="resize: both;overflow: auto;">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">test</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
</a>
</header>
<div class="aui-dialog2-content">
<p>nothing</p>
</div>
<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-submit-button" class="aui-button aui-button-primary">ok</button>
</div>
</footer>
</section>

but I got this:

failed.png

here is my code on JS Bin.

need your help and suggestions,

thank you.

1 answer

1 accepted

0 votes
Answer accepted
Daz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2017

Hi @Chien-Hao Chen,

The CSS "resize" property only applies to form input elements, so it won't help you change the size of the dialog element dynamically.

You've currently got the `aui-dialog2-small` CSS class on the dialog. If you want it to be larger, you could change that to `aui-dialog2-xlarge`; check the "HTML Attributes" section of Dialog2's documentation for the valid CSS class values you can add to change the dialog's size.

The preset sizes for dialog2 will automatically resize with the browser as it shrinks in size; this allows them to work on mobile devices like iPads.

If what you really want to do is make the dialog take up most of the browser's width and height, you could first remove the `aui-dialog2-xyz` size class, then create your own that does something similar, using either CSS calc or fixed positioning to determine the appropriate size to render at. I don't recommend this, as it will be susceptible to breaking if and when either Jira or AUI make design changes.

Suggest an answer

Log in or Sign up to answer