Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This page is for application designers who want to know more details about how to set sizes and positions for layout components.

Overview

When you are designing GUI screens for an application, it can be tricky to get the various components to size and to change in response to different screens (desktop or mobile).

When changing the size and position of layout components, you need to choose which level you want to apply the change. In the properties tab for layout components there are three sections you can use:

  • Position Settings: set these common size and position options that only affect the selected layout component
  • CSS Properties: also applies only to this component. CSS Properties lets you set less common CSS options, such as z-index.
  • Shared Styles: you can set the size and position once and then apply it multiple components by sharing the style.

Positioning

Position settings can be:

  • absolute, where set the location of a component with in its parent.  This can be useful where you want a component to always appear in the same place, for example a logo. However, it prevents the component from flowing with other things on the screen.
  • relative, the component is positioned relative to siblings. This allows items to flow or flex. Use relative positioning if you want your application layout to be responsive to different screen sizes.

Error rendering macro 'multimedia' : com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'Positioning.mp4'

Absolute or Fixed Position

For example to fix something to the top left of its parent area, set Position Settings  Top to 0 and Left to 0. Where you have a fixed layout component combined with components that have relative positioning, be aware that:

  • the fixed component's size depends on the Position Settings → Width and Height. If no value is set it will have the default minimum size.
  • other components will flow over the top of a fixed component. This is because components default to a z-index of 1. z-index controls the in front/behind position.

Bringing a fixed object to the front

If you have a fixed component behind another component, you can move it to be in front using the  z-index. By default objects have a z-index of 1. To move something in front, in CSS Properties set:

  • CSS Tag:  z-index
  • Value to be greater than 1.
    2 is sufficient to bring a component to the front. However, if you use a larger increment, for example 10, this give you flexibility for adding more layers if they are needed later.

Relative Position

By setting the properties on a parent area, you can determine how the child objects are positioned relative to each other.

To set how components align, use Style Settings → Direction

  • Row puts components next to each other until the horizontal space is filled. It will then start a new row.
  • Column puts components below each other until the vertical space is filled. it will then start a new column.

Additional style settings affect the child objects. The following settings provide very responsive design.

  • Wrap: Wrap - allows components to start a new row or column when all space is filled.  This also means when the screen size changes, the components will flow onto additional rows, rather than disappearing off-screen.
  • Justify: Flex Start - tells the first component to be in the top left
  • Align: Stretch - tells each component to stretch to fit the available space. If all components fit on one row, then the components extend to fill the vertical space. If components have to wrap to form a second row, each row will occupy half the vertical space.

There is a Theme 2 demonstration dashboard that you can use to see how this works. In the repository Packages section navigate to Theme2 - App Builder. Right-click T2 - Example Dashboard. and select Display. When you resize the screen, you can see that the different areas move to remain visible in the smaller window.

When you change a layout component from flowing within its parent to having a fixed position, depending on other settings:

  • it's size may change
  • it may be behind or in front of another component.


Size

To size layout components on a dashboard you can use

  • set the width and height
  • set a size either proportionally, using a percentage or with a fixed value in pixels
  • Autosize - works with flex box to take up space
  • Push depending on children


Error rendering macro 'multimedia' : com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'SizingObjects.mp4'

TILE - area 

properties Style Settings

Fixed size using pixels

Width: 300px

Height: 300px

Fixed size using percentage

Width: 75px

Height: 75px


Autosize depends on the parent object having a flex box set.

Autosize uses the available space

Style Settings → Autosize tick

Howmuch space occupied depends on

  • other component - if it has a minimum or fixed width set or also has autosize 

In the video, 2 components with autosize each take up 50% of the row. When the map does not have autosize, it takes up its minimum space whilst the tile to its left expands to fill the available space

Components only "grow" in the direction in which the parent allows them to flex. For example, if the parent has a Direction of Row, components adjust to fit the width available in the row. if the parent has a Direction of Column, components adjust to fit the height availbable in the column.


Sizing (Video: SizingObjects)
Absolute and Relative also applies to sizing:
Absolute Size
Set using Position Settings and setting these values using a CSS Style e.g. Shared Style
Relative Size
Relative sizing provides a size relative to its siblings and can also be controlled by its ancestors e.g. a parent area can be set to stretch its children.
• Percentage: This can be set using percentages %, or by implementing CSS Flexbox, float or grid. For example: width 50%, an item will take up 50% of the space provided by its parent.
• Auto size: will consume all available space from the parent, when and only when the parent has Flexbox properties set. Further to this the space consumed will be perpendicular to the Flex e.g. If the parent is set to Flex Row, and the child has auto size ticked, then the child will consume the available space vertically.
• Content Sizing: a parent element will be expanded to accommodate its children. While Auto Size consumes the available space, content sizing will push beyond the available space. Note that Content sizing is not a setting but the lack of an auto size or other constraint being set.

Error rendering macro 'multimedia' : com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'Flexbox.mp4'


Flex Box (Video: Flexbox)
Column
The content is laid out vertically in a column:
• Wrap: Starts a new column when the existing column is full.
• Justify: Where the content will be placed vertically.
• Align: Where the content will be aligned horizontally
a. Stretch can be selected here to have this object stretch the objects inside it in the direction of the flex i.e. in a column.
Row
The content in laid out horizontally in a row:
• Wrap: Starts a new row when the existing row is full.
• Justify: Where the content will be placed vertically.
• Align: Where the content will be aligned horizontally
a. Stretch can be selected here to have this object stretch the child objects inside it in the direction of the flex i.e. in a row.
Auto size
Auto Size can be applied to objects to make them consume all available space perpendicular to the flex box direction from the parent, when and only when the parent has Flexbox properties set will auto size work.


  • No labels