---
title:
  zh-CN: 基础样例
  en-US: Basic Usage
order: 0
---

## zh-CN

最简单的用法。

## en-US

Simplest of usage.

```ts
import { Component } from '@angular/core';
import { SFSchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd';
import { of } from 'rxjs';

@Component({
  selector: 'app-demo',
  template: `<sf [schema]="schema" (formSubmit)="submit($event)"></sf>`
})
export class DemoComponent {
    schema: SFSchema = {
        properties: {
            'sex': {
                'type': 'string',
                'title': 'Sex',
                'enum': [ '男', '女', '未知' ],
                'ui': {
                    'widget': 'radio',
                    'styleType': 'button'
                },
                'default': '未知'
            },
            // 异步数据
            'async': {
                'type': 'string',
                'title': 'Async',
                'ui': {
                    'widget': 'radio',
                    asyncData: () => of([ '男', '女', '未知' ])
                }
            }
        }
    };
    constructor(public msg: NzMessageService) { }
    submit(value: any) { this.msg.success(JSON.stringify(value)); }
}
```
