Pode.Web icon indicating copy to clipboard operation
Pode.Web copied to clipboard

Button in Form

Open eugen257 opened this issue 2 years ago • 3 comments

Hi,

how can i apply cssstyle to button? New-PodeWebForm -Name 'name' -Content @() -CssStyle @{?????} -ScriptBlock {}

like this: image

eugen257 avatar Oct 04 '22 15:10 eugen257

Hi @eugen257,

-CssStyle is just a hastable that takes the raw CSS property name/values. Such as:

-CssStyle @{ 'background-color' = 'purple' }

Badgerati avatar Oct 04 '22 22:10 Badgerati

Hi @Badgerati,

it only affects the form itself: image

eugen257 avatar Oct 06 '22 12:10 eugen257

Have you tried using the -CssStyle @{ 'background-color' = 'purple' } parameter on the New-PodeWebButton itself instead of the whole form? As documented here: https://badgerati.github.io/Pode.Web/Functions/Elements/New-PodeWebButton/

jbaechtelMT avatar Oct 22 '22 23:10 jbaechtelMT

Hi @jbaechtelMT,

thanks )), but I meant when using the form: New-PodeWebForm is it possible to do something with the button.

eugen257 avatar Nov 23 '22 14:11 eugen257

Hi @eugen257,

If you want to style the button the form renders you'll need to use -CssClass to give the form a custom class:

New-PodeWebForm -Name Example -CssClass 'my-custom-class'

Then create a CSS file at /public/custom.css to pin-point the button:

form.my-custom-class button[type='submit'] {
    /* your properties here */
}

And then you can load the CSS file in Pode.Web via `Import-PodeWebStylesheet -Url '/custom.css'

Badgerati avatar Nov 29 '22 21:11 Badgerati

Thanks @Badgerati 👍

eugen257 avatar Dec 15 '22 11:12 eugen257