Having 2 buttons on same row in Show-UDModal

Guys,

any one was able to have 2 buttons on the same row when using Modal below is a sample code and an image.

Get-UDDashboard | Stop-UDDashboard
Import-Module UniversalDashboard.community


Start-UDDashboard -Dashboard (
    New-UDDashboard -Title "Test" -Content {
     
    New-UDButton -Text "test" -OnClick {
    
    Show-UDModal -Content {

       New-UDCard -Id "Card" -Title "Results"

       New-UDElement -Tag ‘pa’ -Attributes @{‘class’=‘left-align’} -Content {
       
        New-UDButton -BackgroundColor "#26a69a" -Text "Restore" -Icon play -OnClick { Hide-UDModal }
        }
        New-UDElement -Tag ‘p’ -Attributes @{‘class’=‘right-align’} -Content {
        
        New-UDButton -BackgroundColor "#26a69a" -Text "Close" -Icon play -OnClick { Hide-UDModal }
        }
        } } }    


) -Port 1000 -AutoReload

is there a way to have both buttons one on the left and the other button on the right.

Hey @wsl2001 good to see you back in the forums :slight_smile: well I tried and failed miserably trying to do this with HTML :frowning: so I cheated and used new-ud row, and new-udcolumn to give the effect:-

Import-Module UniversalDashboard.community
Get-UDDashboard | Stop-UDDashboard
Start-UDDashboard -Dashboard (
    New-UDDashboard -Title "Test" -Content {

        New-UDButton -Text "test" -OnClick {

            Show-UDModal -Content {

                New-UDCard -Id "Card" -Title "Results"
                New-UDRow -Columns {
                    New-UDColumn -size 3 -Content {
                        New-UDElement -Tag 'span' -Attributes @{'float' = 'left' } -Content {

                            New-UDButton -BackgroundColor "#26a69a" -Text "Restore" -Icon play -OnClick { Hide-UDModal }
                        }
                    }
                    New-UDColumn -size 6 -Content { }
                    New-UDColumn -size 3 -Content {
                        New-UDElement -Tag 'span' -Attributes @{'float' = 'right' } -Content {

                            New-UDButton -BackgroundColor "#26a69a" -Text "Close" -Icon play -OnClick { Hide-UDModal }
                        }
                    }
                }
            } } }


) -Port 1000   

testing this, it gives me

1 Like

Not to stomp on @psDevUK :wink: how about placing the buttons in the footer of the modal?

… -FixedFooter -Footer { }

1 Like