# [Usage](../../../usage.md) > [Components](../basics.md) > Form

A component to automatically generate a form container, which is basically a `Card` component encased in a form. Use it when you need validated user input posted to a route or URL with automatic Cancel/Submit handling; use a plain [Card](../../components/visuals/card.md) instead when you only need to display content or group components without posting.

Every form handles method `POST`, and handles a route or an URL as action. The Form component generates automatically two buttons: Cancel and Submit, each can be disabled.  
NOTE: Cancel button will redirect back to the previous page.

![image](img/form_1.png)

```php
@php
    $options = [
        1 => 'Option 1',
        2 => 'Option 2'
    ];
@endphp

{!!
  \KFramework\Components\Forms\Form::make()
    ->setColumns(2)
    ->setSchema([
        \KFramework\Components\Forms\Input::make()
            ->setLabel('Input 1'),
        \KFramework\Components\Forms\Select::make()
            ->setLabel('Select')
            ->setRequired()
            ->setPostIcon('account-badge')
            ->setPlaceholder()
            ->setOptions($options)
    ])
!!}
```
// Realistic end-to-end example: create-user form with values and POST action.
// Blade (`resources/views/users/create.blade.php`):
```php
{!!
  \KFramework\Components\Forms\Form::make()
    ->setAction(route('users.store'))
    ->setColumns(2)
    ->setValues(['role' => 'user'])
    ->setSchema([
        \KFramework\Components\Forms\Input::make('name')->setLabel('Name')->setRequired(),
        \KFramework\Components\Forms\Select::make('role')->setLabel('Role')->setOptions([ 'user' => 'User', 'admin' => 'Admin' ]),
    ])
!!}
```
// Controller:
```php
use KFramework\Components\Forms\Form;
use KFramework\Components\Forms\Input;
use KFramework\Components\Forms\Select;

public function create()
{
    $form = Form::make()
        ->setAction(route('users.store'))
        ->setColumns(2)
        ->setSchema([
            Input::make('name')->setLabel('Name')->setRequired(),
            Select::make('role')->setLabel('Role')->setOptions(['user' => 'User', 'admin' => 'Admin']),
        ]);

    return view('users.create', compact('form'));
}
```
---

## Usage
- Blade:
```php
{!! \KFramework\Components\Forms\Form::make() !!}
```
- Controller:
```php
Form::make()
```
---

## Standard attributes

- `uuid`
- `id`
- `classes`
- `extraAttributes`
- `style`
- `schema` — array of child components (inputs, selects, repeaters) rendered in the form grid.
- `values` — associative `name => value` map used to prefill the schema on edit pages.
- `defaults`
- `columns`
- `columnSpan`
- `disableCancel`
- `disableSubmit`
- `url` — raw URL the form posts to when you do not want a named route.
- `action` — named route or URL the form posts to; checked against role permissions.
- `progressBar`
- `confirmationMessage`


See their usage and description [here](../basics.md).

---
## Component-specific attributes

### `formRecord` | `->setFormRecord()`
You can set a Laravel Model record for the form, the form will compile automatically with the values from the record, based on name of inputs. Read more [here](../../utilities/backend/form_autofill.md).  

| Types   | Default |
|---------|---------|
| `Model` | `null`  |

## See also
- [Components basics](../basics.md)
- [Input](input.md), [Select](select.md), [TextArea](text_area.md), [Checkbox](checkbox.md), [Repeater](repeater.md), [File Uploader](file_uploader.md)
- [Card](../visuals/card.md), [Modal](../visuals/modal.md)
- [schema](../shared_attributes/schema.md), [values](../shared_attributes/values.md), [columns](../shared_attributes/columns.md)
- [form_autofill](../../utilities/backend/form_autofill.md)