inputs Last updated: 2022-10-04

Elements are part of the resource, so you should read this article carefully to understand that everything regarding elements in Dash package is prepared to be very easy, magic, simple , and does not take much time to be created.

Almost all the Elements you need are available and even more extra elements we have prepared for you

But let's talk about the main elements

List of available elements

text() 
textarea()
select()
checkbox()
radio()
search()
number()
month()
week()
email()
password()
fileUpload()
tel()
color()
fileUpload()
video()
image()
audio()

 

It will work with you on any resource

But how are we going to write it?

All elements are auxiliary functions that create the element for you without interfering with anything and you can modify it with the rest of its sub-functions

Let's take an example of a text field

And all of the following you will be able to apply to the elements that are logically applicable according to HTML

public function fields() {
		return [
			id()->make('ID', 'id'),
			text()->make('name') 
		];
}

`text()->make('name')` See here we used make() method And we gave it one name, which is

 used in the case of displaying  the name and also used to refer to the database as a name for the field

What if we wrote it like this? `text()->make('User Name')` 

It will be initialized as a snake relative to the base field user_name As for the displayed name, it will be in the same case

User Name 

Well then what if we wanted to put dynamic labels ?

Then we will use the second part in the same function .

we need to add new parameter 

public function fields() {
		return [
			id()->make('ID', 'id'),
			text()->make('User Name','name') 
		];	
}

In the first parameter we put the display name according to the format you want, but in the second parameter it will be the field for the table in your database
You can apply the same example to the rest of the elements very easily


So we can now easily add other elements and customize them

public function fields() {
		return [
			id()->make('ID', 'id'),
			text()->make('User Name','name'),
			email()->make('Email Address','email'),
			password()->make('Password','password'),  
		];	
}

Let's move to the second part to learn about the auxiliary functions through which fields can be customized more flexibly according to your needs..