| 1 |
--- |
| 2 |
id: Sizing |
| 3 |
section: foundations-and-styles |
| 4 |
subsection: utility-classes |
| 5 |
---import './Sizing.css' |
| 6 |
|
| 7 |
## Examples |
| 8 |
|
| 9 |
### Width base and percentage units |
| 10 |
|
| 11 |
```html |
| 12 |
<div class="ws-example-u-sizing-item pf-v6-u-w-0">.pf-v6-u-w-0</div> |
| 13 |
<div class="ws-example-u-sizing-item pf-v6-u-w-25">.pf-v6-u-w-25</div> |
| 14 |
<div class="ws-example-u-sizing-item pf-v6-u-w-50">.pf-v6-u-w-50</div> |
| 15 |
<div class="ws-example-u-sizing-item pf-v6-u-w-75">.pf-v6-u-w-75</div> |
| 16 |
<div class="ws-example-u-sizing-item pf-v6-u-w-100">.pf-v6-u-w-100</div> |
| 17 |
<div |
| 18 |
class="ws-example-u-sizing-item pf-v6-u-w-initial" |
| 19 |
>.pf-v6-u-w-initial (auto)</div> |
| 20 |
<div class="ws-example-u-sizing-item pf-v6-u-w-inherit">.pf-v6-u-w-inherit</div> |
| 21 |
|
| 22 |
``` |
| 23 |
|
| 24 |
### Usage |
| 25 |
|
| 26 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.pf-v6-u-w-initial-on-lg` |
| 27 |
|
| 28 |
| Class | Applied to | Outcome | |
| 29 |
| -- | -- | -- | |
| 30 |
| `.pf-v6-u-w-initial{-on-[breakpoint]}` | `*` | Sets width: initial (auto) | |
| 31 |
| `.pf-v6-u-w-inherit{-on-[breakpoint]}` | `*` | Sets width: inherit | |
| 32 |
| `.pf-v6-u-w-0{-on-[breakpoint]}` | `*` | Sets width: 0% | |
| 33 |
| `.pf-v6-u-w-25{-on-[breakpoint]}` | `*` | Sets width: 25% | |
| 34 |
| `.pf-v6-u-w-33{-on-[breakpoint]}` | `*` | Sets width: calc(100% / 3) | |
| 35 |
| `.pf-v6-u-w-50{-on-[breakpoint]}` | `*` | Sets width: 50% | |
| 36 |
| `.pf-v6-u-w-66{-on-[breakpoint]}` | `*` | Sets width: calc(100% / 3 \* 2) | |
| 37 |
| `.pf-v6-u-w-75{-on-[breakpoint]}` | `*` | Sets width: 75% | |
| 38 |
| `.pf-v6-u-w-100{-on-[breakpoint]}` | `*` | Sets width: 100% | |
| 39 |
|
| 40 |
### Width viewport units |
| 41 |
|
| 42 |
```html isFullscreen |
| 43 |
<div class="ws-example-u-sizing-item pf-v6-u-w-25vw">.pf-v6-u-w-25vw</div> |
| 44 |
<div class="ws-example-u-sizing-item pf-v6-u-w-33vw">.pf-v6-u-w-33vw</div> |
| 45 |
<div class="ws-example-u-sizing-item pf-v6-u-w-50vw">.pf-v6-u-w-50vw</div> |
| 46 |
<div class="ws-example-u-sizing-item pf-v6-u-w-66vw">.pf-v6-u-w-66vw</div> |
| 47 |
<div class="ws-example-u-sizing-item pf-v6-u-w-75vw">.pf-v6-u-w-75vw</div> |
| 48 |
<div class="ws-example-u-sizing-item pf-v6-u-w-100vw">.pf-v6-u-w-100vw</div> |
| 49 |
|
| 50 |
``` |
| 51 |
|
| 52 |
### Usage |
| 53 |
|
| 54 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.pf-v6-u-w-25vw-on-lg` |
| 55 |
|
| 56 |
| Class | Applied to | Outcome | |
| 57 |
| -- | -- | -- | |
| 58 |
| `.pf-v6-u-w-25vw{-on-[breakpoint]}` | `*` | Sets width: 25vw | |
| 59 |
| `.pf-v6-u-w-33vw{-on-[breakpoint]}` | `*` | Sets width: calc(100vw / 3) | |
| 60 |
| `.pf-v6-u-w-50vw{-on-[breakpoint]}` | `*` | Sets width: 50vw | |
| 61 |
| `.pf-v6-u-w-66vw{-on-[breakpoint]}` | `*` | Sets width: calc(100vw / 3 \* 2) | |
| 62 |
| `.pf-v6-u-w-75vw{-on-[breakpoint]}` | `*` | Sets width: 75vw | |
| 63 |
| `.pf-v6-u-w-100vw{-on-[breakpoint]}` | `*` | Sets width: 100vw | |
| 64 |
|
| 65 |
### Height base and percentage units |
| 66 |
|
| 67 |
```html |
| 68 |
<div |
| 69 |
class="ws-example-u-sizing-item pf-v6-u-h-0 pf-v6-u-display-inline-block" |
| 70 |
>.pf-v6-u-h-0</div> |
| 71 |
<div |
| 72 |
class="ws-example-u-sizing-item pf-v6-u-h-25 pf-v6-u-display-inline-block" |
| 73 |
>.pf-v6-u-h-25</div> |
| 74 |
<div |
| 75 |
class="ws-example-u-sizing-item pf-v6-u-h-50 pf-v6-u-display-inline-block" |
| 76 |
>.pf-v6-u-h-50</div> |
| 77 |
<div |
| 78 |
class="ws-example-u-sizing-item pf-v6-u-h-75 pf-v6-u-display-inline-block" |
| 79 |
>.pf-v6-u-h-75</div> |
| 80 |
<div |
| 81 |
class="ws-example-u-sizing-item pf-v6-u-h-100 pf-v6-u-display-inline-block" |
| 82 |
>.pf-v6-u-h-100</div> |
| 83 |
<div |
| 84 |
class="ws-example-u-sizing-item pf-v6-u-h-initial pf-v6-u-display-inline-block" |
| 85 |
>.pf-v6-u-h-initial</div> |
| 86 |
<div |
| 87 |
class="ws-example-u-sizing-item pf-v6-u-h-inherit pf-v6-u-display-inline-block" |
| 88 |
>.pf-v6-u-h-inherit</div> |
| 89 |
|
| 90 |
``` |
| 91 |
|
| 92 |
### Usage |
| 93 |
|
| 94 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.pf-v6-u-h-initial-on-lg` |
| 95 |
|
| 96 |
| Class | Applied to | Outcome | |
| 97 |
| -- | -- | -- | |
| 98 |
| `.pf-v6-u-h-initial{-on-[breakpoint]}` | `*` | Sets height: initial (auto) | |
| 99 |
| `.pf-v6-u-h-inherit{-on-[breakpoint]}` | `*` | Sets height: inherit | |
| 100 |
| `.pf-v6-u-h-0{-on-[breakpoint]}` | `*` | Sets height: 0% | |
| 101 |
| `.pf-v6-u-h-25{-on-[breakpoint]}`| `*` | Sets height: 25% | |
| 102 |
| `.pf-v6-u-h-33{-on-[breakpoint]}`| `*` | Sets height: calc(100% / 3) | |
| 103 |
| `.pf-v6-u-h-50{-on-[breakpoint]}`| `*` | Sets height: 50% | |
| 104 |
| `.pf-v6-u-h-66{-on-[breakpoint]}`| `*` | Sets height: calc(100% / 3 \* 2) | |
| 105 |
| `.pf-v6-u-h-75{-on-[breakpoint]}`| `*` | Sets height: 75% | |
| 106 |
| `.pf-v6-u-h-100{-on-[breakpoint]}` | `*` | Sets height: 100% | |
| 107 |
|
| 108 |
### Height viewport units |
| 109 |
|
| 110 |
```html isFullscreen |
| 111 |
<div |
| 112 |
class="ws-example-u-sizing-item pf-v6-u-h-25vh pf-v6-u-display-inline-block" |
| 113 |
>.pf-v6-u-h-25vh</div> |
| 114 |
<div |
| 115 |
class="ws-example-u-sizing-item pf-v6-u-h-33vh pf-v6-u-display-inline-block" |
| 116 |
>.pf-v6-u-h-33vh</div> |
| 117 |
<div |
| 118 |
class="ws-example-u-sizing-item pf-v6-u-h-50vh pf-v6-u-display-inline-block" |
| 119 |
>.pf-v6-u-h-50vh</div> |
| 120 |
<div |
| 121 |
class="ws-example-u-sizing-item pf-v6-u-h-66vh pf-v6-u-display-inline-block" |
| 122 |
>.pf-v6-u-h-66vh</div> |
| 123 |
<div |
| 124 |
class="ws-example-u-sizing-item pf-v6-u-h-75vh pf-v6-u-display-inline-block" |
| 125 |
>.pf-v6-u-h-75vh</div> |
| 126 |
<div |
| 127 |
class="ws-example-u-sizing-item pf-v6-u-h-100vh pf-v6-u-display-inline-block" |
| 128 |
>.pf-v6-u-h-100vh</div> |
| 129 |
|
| 130 |
``` |
| 131 |
|
| 132 |
### Usage |
| 133 |
|
| 134 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.pf-v6-u-h-25vh-on-lg` |
| 135 |
|
| 136 |
| Class | Applied to | Outcome | |
| 137 |
| -- | -- | -- | |
| 138 |
| `.pf-v6-u-h-25vh{-on-[breakpoint]}` | `*` | Sets height: 25vh | |
| 139 |
| `.pf-v6-u-h-33vh{-on-[breakpoint]}` | `*` | Sets height: calc(100vh / 3) | |
| 140 |
| `.pf-v6-u-h-50vh{-on-[breakpoint]}` | `*` | Sets height: 50vh | |
| 141 |
| `.pf-v6-u-h-66vh{-on-[breakpoint]}` | `*` | Sets height: calc(100vh / 3 \* 2) | |
| 142 |
| `.pf-v6-u-h-75vh{-on-[breakpoint]}` | `*` | Sets height: 75vh | |
| 143 |
| `.pf-v6-u-h-100vh{-on-[breakpoint]}` | `*` | Sets height: 100vh | |
| 144 |
|
| 145 |
### Min width |
| 146 |
|
| 147 |
```html |
| 148 |
<div |
| 149 |
class="pf-v6-u-min-width" |
| 150 |
style="--pf-v6-u-min-width--MinWidth: 50ch;" |
| 151 |
>Min-width 50ch example</div> |
| 152 |
|
| 153 |
``` |
| 154 |
|
| 155 |
### Max width |
| 156 |
|
| 157 |
```html |
| 158 |
<div |
| 159 |
class="pf-v6-u-max-width" |
| 160 |
style="--pf-v6-u-max-width--MaxWidth: 50ch;" |
| 161 |
>Max-width 50ch example</div> |
| 162 |
|
| 163 |
``` |
| 164 |
|
| 165 |
### Min and max width |
| 166 |
|
| 167 |
```html |
| 168 |
<div |
| 169 |
class="pf-v6-u-min-width pf-v6-u-max-width" |
| 170 |
style="--pf-v6-u-min-width--MinWidth: 30ch; --pf-v6-u-max-width--MaxWidth: 50ch;" |
| 171 |
>Min-width 30ch, max-width 50ch example</div> |
| 172 |
|
| 173 |
``` |
| 174 |
|
| 175 |
### Responsive width control |
| 176 |
|
| 177 |
```html |
| 178 |
<div |
| 179 |
class="pf-v6-u-min-width pf-v6-u-max-width" |
| 180 |
style="--pf-v6-u-min-width--MinWidth: 20ch; --pf-v6-u-max-width--MaxWidth: 30ch; --pf-v6-u-max-width--MaxWidth-on-md: 50ch; --pf-v6-u-max-width--MaxWidth-on-xl: 70ch;" |
| 181 |
>Min-width 20ch, max-width 30ch, max-width-on-md 50ch, max-width-on-xl 70ch example</div> |
| 182 |
|
| 183 |
``` |
| 184 |
|
| 185 |
### Usage |
| 186 |
|
| 187 |
| Class | Applied to | Outcome | |
| 188 |
| -- | -- | -- | |
| 189 |
| `.pf-v6-u-min-width` | `*` | Sets min-width: `var(--pf-v6-u-min-width--MinWidth{-on-[breakpoint]})`. | |
| 190 |
| `.pf-v6-u-max-width` | `*` | Sets min-width: `var(--pf-v6-u-max-width--MaxWidth{-on-[breakpoint]})`. | |
| 191 |
|
| 192 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.--pf-v6-u-min-width--MinWidth-on-lg` |
| 193 |
|
| 194 |
| Custom property | Applied to | Outcome | |
| 195 |
| -- | -- | -- | |
| 196 |
| `--pf-v6-u-min-width--MinWidth{-on-[breakpoint]}: {width}` | `.pf-v6-u-min-width` | Modifies the min width custom property. | |
| 197 |
| `--pf-v6-u-max-width--MaxWidth{-on-[breakpoint]}: {width}` | `.pf-v6-u-max-width` | Modifies the max width custom property. | |
| 198 |
|
| 199 |
### Min height |
| 200 |
|
| 201 |
```html |
| 202 |
<div |
| 203 |
class="pf-v6-u-min-height" |
| 204 |
style="--pf-v6-u-min-height--MinHeight: 50ch;" |
| 205 |
>Min-height 50ch example</div> |
| 206 |
|
| 207 |
``` |
| 208 |
|
| 209 |
### Max height |
| 210 |
|
| 211 |
```html |
| 212 |
<div |
| 213 |
class="pf-v6-u-max-height" |
| 214 |
style="--pf-v6-u-max-height--MaxHeight: 50ch;" |
| 215 |
>Max-height 50ch example</div> |
| 216 |
|
| 217 |
``` |
| 218 |
|
| 219 |
### Min and max height |
| 220 |
|
| 221 |
```html |
| 222 |
<div |
| 223 |
class="pf-v6-u-min-height pf-v6-u-max-height" |
| 224 |
style="--pf-v6-u-min-height--MinHeight: 30ch; --pf-v6-u-max-height--MaxHeight: 50ch;" |
| 225 |
>Min-height 30ch, max-height 50ch example</div> |
| 226 |
|
| 227 |
``` |
| 228 |
|
| 229 |
### Responsive height control |
| 230 |
|
| 231 |
```html |
| 232 |
<div |
| 233 |
class="pf-v6-u-min-height pf-v6-u-max-height" |
| 234 |
style="--pf-v6-u-min-height--MinHeight: 20ch; --pf-v6-u-max-height--MaxHeight: 30ch; --pf-v6-u-max-height--MaxHeight-on-md: 50ch; --pf-v6-u-max-height--MaxHeight-on-xl: 70ch;" |
| 235 |
>Min-height 20ch, max-height 30ch, max-height-on-md 50ch, max-height-on-xl 70ch example</div> |
| 236 |
|
| 237 |
``` |
| 238 |
|
| 239 |
### Usage |
| 240 |
|
| 241 |
| Class | Applied to | Outcome | |
| 242 |
| -- | -- | -- | |
| 243 |
| `.pf-v6-u-min-height` | `*` | Sets min-height: `var(--pf-v6-u-min-height--MinHeight{-on-[breakpoint]})`. | |
| 244 |
| `.pf-v6-u-max-height` | `*` | Sets max-height: `var(--pf-v6-u-max-height--MaxHeight{-on-[breakpoint]})`. | |
| 245 |
|
| 246 |
[Breakpoints](/foundations-and-styles/design-tokens/all-design-tokens) are optional. Breakpoint options include: base (no breakpoint value), `-on-sm`, `-on-md`, `-on-lg`, and `-on-xl`. Example: `.--pf-v6-u-min-height--MinHeight-on-lg` |
| 247 |
|
| 248 |
| Custom property | Applied to | Outcome | |
| 249 |
| -- | -- | -- | |
| 250 |
| `--pf-v6-u-min-height--MinHeight{-on-[breakpoint]}: {height}` | `.pf-v6-u-min-height` | Modifies the min height custom property. | |
| 251 |
| `--pf-v6-u-max-height--MaxHeight{-on-[breakpoint]}: {height}` | `.pf-v6-u-max-height` | Modifies the max height custom property. | |