| description | Modal component for Universal Apps. |
|---|
Modals inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
New-UDButton -Text 'Basic' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
}
}New-UDButton -Text 'Full Screen' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Footer {
New-UDButton -Text "Close" -OnClick { Hide-UDModal }
} -FullScreen
}Full width modals take up the full width as defined by the -MaxWidth parameter.
New-UDButton -Text 'Full Width' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -FullWidth -MaxWidth 'md'
}Persistent modals do not close when you click off of them. You will have to close it with Hide-UDModal.
New-UDButton -Text 'Persistent' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Footer {
New-UDButton -Text "Close" -OnClick { Hide-UDModal }
} -Persistent
}You can use the Hide-UDModal button to hide a modal that is currently show.
New-UDButton -Text 'Basic' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
}
Start-Sleep 5
Hide-UDModal
}When opening multiple modals, you can also use the -All parameter of Hide-UDModal to hide all of them instead of one at a time.
New-UDButton -Text 'Parent' -OnClick {
Show-UDModal -Content {
New-UDButton -Text 'Child' -OnClick {
Show-UDModal -Content {
New-UDButton -Text 'hide current' -OnClick {
Hide-UDModal
}
New-UDButton -Text 'hide all' -OnClick {
Hide-UDModal -All
}
}
}
}
}You can style modules using the -Style, -HeaderStyle, -ContentStyle and -FooterStyle parameters. Style is applied to the entire modal itself and the individual section styles are only applied to those sections. The value for these parameters are hashtables of CSS values.
New-UDButton -Text 'Styling' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Style @{
backgroundColor = "red"
}
}.png)
.png)
.png)
.png)