How to make dialog2 resizable dynamically

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

Accepted Answer
0 votes

Hi @Hao,

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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23,693 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you