# Adding Padding to ui-textbox

**URL:** https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565
**Category:** Dashboard
**Tags:** node-red-dashboard
**Created:** [9 March 2022 07:15 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565 "2022-03-09T07:15:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Ganesh](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Ganesh](https://discourse.nodered.org/u/Ganesh)
#### Post date: [9 March 2022 07:15 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/1 "2022-03-09T07:15:02Z")

</div>

Hi  
On my dashboard screen I have multiple UI-Textboxes, I want to give padding to a one UI-Textbox out of multiple UI-Textbox , is there a way to do that , I have tried using Group padding setting in Site but it applies padding to every element present on screen whereas I want it for only a few elements  
Thanks & Regards

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [9 March 2022 09:58 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/2 "2022-03-09T09:58:22Z")

</div>

If by 'ui-textbox' you mean the `text` or `text input` node, they both have a `</> Class` to allow you to add 'Oprional CSS class name(s) for widget' so you can add a `ui-template` node and add in the CSS you want,

per the node's HELP section

> If a **Class** is specified, it will be added to the parent card. This way you can style the card and the elements inside it with custom CSS. The Class can be set at runtime by setting a `msg.className` string property.

---

<div class="post-metadata">

### Author: ![Ganesh](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Ganesh](https://discourse.nodered.org/u/Ganesh)
#### Post date: [9 March 2022 10:33 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/3 "2022-03-09T10:33:24Z")

</div>

Hi @zenofmud  
Thanks for the reply , I am talking about text node , To Sum up if I add a class name to the node then make any changes in the CSS styles it will only affect to that node not the others right.  
can you please share an example or any reference on how to use optional class name and add CSS  
Thank you & Regards

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [9 March 2022 11:07 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/4 "2022-03-09T11:07:25Z")

</div>

Here is a simple example with two `ui-text` nodes, one with a class added and the other without:  
 ![Screen Shot 2022-03-09 at 6.05.53 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/109103f03e64c8c3ef387639f7421326eafc3733.png)

Here is the flow:

```auto
[{"id":"b42d78e6a766e16f","type":"ui_text","z":"0c912221f9a64941","group":"4f47a445ed561501","order":7,"width":0,"height":0,"name":"","label":"no padding","format":"{{msg.payload}}","layout":"row-spread","className":"","x":570,"y":160,"wires":[]},{"id":"5498888da80f7655","type":"ui_text","z":"0c912221f9a64941","group":"4f47a445ed561501","order":7,"width":0,"height":0,"name":"padding added","label":"padding","format":"{{msg.payload}}","layout":"row-spread","className":"pad-this","x":580,"y":240,"wires":[]},{"id":"bf57bc0327903a5d","type":"inject","z":"0c912221f9a64941","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hello world","payloadType":"str","x":240,"y":200,"wires":[["b42d78e6a766e16f","5498888da80f7655"]]},{"id":"e206fc331fb2c499","type":"ui_template","z":"0c912221f9a64941","group":"4f47a445ed561501","name":"","order":2,"width":0,"height":0,"format":"<style>\n .pad-this {padding: 25%;}\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":480,"y":80,"wires":[[]]},{"id":"4f47a445ed561501","type":"ui_group","name":"Default","tab":"755779fe1b6a2182","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"755779fe1b6a2182","type":"ui_tab","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![Ganesh](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Ganesh](https://discourse.nodered.org/u/Ganesh)
#### Post date: [9 March 2022 11:45 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/5 "2022-03-09T11:45:39Z")

</div>

Hi @zenofmud  
Thanks for the Example , It works it was exactly what I wanted  
Thanks & Regards

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 March 2022 11:46 UTC](https://discourse.nodered.org/t/adding-padding-to-ui-textbox/59565/6 "2022-03-23T11:46:26Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
