2022-11-07 09:42:52 +08:00
# How to extend fields
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
The composition of a Collection Field in NocoBase consists of
2022-11-02 11:33:07 +08:00
< img src = "./collection-field.svg" / >
2022-11-07 09:42:52 +08:00
## Extend Field Type
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
For example, to extend the password type field ``type: 'password'`
2022-11-02 11:33:07 +08:00
```ts
export class MyPlugin extends Plugin {
beforeLoad() {
this.db.registerFieldTypes({
password: PasswordField
});
}
}
export class PasswordField extends Field {
get dataType() {
return DataTypes.STRING;
}
}
```
2022-11-07 09:42:52 +08:00
- [More implementations of the built-in field types can be found here ](https://github.com/nocobase/nocobase/tree/main/packages/core/database/src/fields )
- Also see the full samples plugin [packages/samples/shop-modeling ](https://github.com/nocobase/nocobase/tree/main/packages/samples/shop-modeling )
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
## Extend Field Component
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
Related extension documentation can be found at
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
- [Extending Schema Components ](/development/client/ui-schema-designer/extending-schema-components )
- [Schema component library ](/development/client/ui-schema-designer/component-library )
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
## Extend Field Interface
2022-11-02 11:33:07 +08:00
2022-11-07 09:42:52 +08:00
- [Built-in field interfaces view here ](https://github.com/nocobase/nocobase/tree/main/packages/core/client/src/collection-manager/interfaces )