
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
treege-consumer
Advanced tools
A React library to consume easily form generated from Treege
npm:
npm install treege-consumer
bun:
bun add treege-consumer
yarn:
yarn add treege-consumer
pnpm:
pnpm add treege-consumer
Give tree data to <TreegeForm> component.
Data can be fetched from your API.
import tree from "./tree.json";
import { TreegeConsumer } from "treege-consumer ";
const App = () => {
const handleSubmit = (data: [string, FormDataEntryValue][]) => {
console.log(data);
};
return <TreegeConsumer tree={tree} onSubmit={handleSubmit}/>;
};
export default App;
Some options can be provided. For example if you want to use place predictions from address field.
import tree from "./tree.json";
import { TreegeConsumer } from "treege-consumer ";
const App = () => {
const handleSubmit = (data: [string, FormDataEntryValue][]) => {
console.log(data);
};
return (
<TreegeConsumer
tree={tree}
onSubmit={handleSubmit}
options={{ googleApiKey: "YOUR_API_KEY" }}/>
);
};
export default App;
Render a form based on Treege data
| Props | Type | Default | Required | Detail |
|---|---|---|---|---|
| tree | TreeNode | undefined | false | Treege data |
| theme | "light" "dark" ThemeOptions | "light" | false | Theme color mode |
| onSubmit | data: JsonFormValue[];formData: [string, FormDataEntryValue][];fieldValues: FieldValues; | undefined | false | Callback fired form is validate |
| options | "countryAutocompleteService" "googleApiKey" "prefixResponseImageUriAutocomplete" | undefined | false | Consumer options |
| style | CSSProperties | undefined | false | Custom form style |
| initialValues | { [key: string]: unknown; } | undefined | false | Set initial value to form |
| ignoreFields | string[] | undefined | false | Ignored fields to render |
| debug | boolean | undefined | false | Debug in console on form submit |
| readOnly | boolean | undefined | false | Read only mode |
| disabledSubmitButton | boolean | undefined | false | Disable submit button |
| isSubmitting | boolean | undefined | false | Disable submit button while submitting |
| renderFormValidation | function({ disabled, isLoading }: RenderFormValidationParams): ReactElement | undefined | false | Custom form validation renderer |
| Options | Type | Default | Required | Detail |
|---|---|---|---|---|
| countryAutocompleteService | string or string[] | false | Define country restrictions for autocomplete | |
| googleApiKey | string | false | If you want use some google service like autocomplete address, then you want provide Google Api Key | |
| prefixResponseImageUriAutocomplete | string | false | Prefix response image uri for autocomplete image | |
| licenseMuiX | string | false | License MUI X to enable pro and premium feature | |
| adapterLocale | string | false | Adapter local for locale format | |
| disablePastDateRangePicker | boolean | false | Disable past for date range picker | |
| disablePastDatePicker | boolean | false | Disable past for date picker | |
| noValidate | boolean | false | Indicate that the form is not to be validated on submit |
Display values from form based on Treege
| Props | Type | Default | Required | Detail |
|---|---|---|---|---|
| values | { label: string; name: string; type: string; tag?: string; value: string; | { label: string; value: string } } | undefined | true | Object of data |
| renderFields | function(input: JsonFormValue): ReactElement | undefined | undefined | false | Custom fields rendering |
| excludedFields | string[] | undefined | false | Excluded fields |
| collapse | boolean | undefined | false | Enable collapse or note |
| collapseVisibleItemNumber | number | 4 | false | Number of visible item before collapse. Works only if collapse is true |
| collapseStyle | CSSProperties | undefined | false | Custom collapse style |
| collapseSx | SxProps | undefined | false | Custom collapse sx |
| style | CSSProperties | undefined | false | Container style |
| sx | SxProps | undefined | false | Container sx |
You can provide options to the consumer by using the TreegeConsumerProvider provider.
import tree from "./tree.json";
import { TreegeConsumer, TreegeConsumerProvider } from "treege-consumer ";
const App = () => {
const handleSubmit = (data: [string, FormDataEntryValue][]) => {
console.log(data);
};
return (
<TreegeConsumerProvider licenseMuiX={"YOUR_LICENCE"}>
<TreegeConsumer
tree={tree}
onSubmit={handleSubmit}
options={{googleApiKey: "YOUR_API_KEY"}}/>
</TreegeConsumerProvider>
);
};
export default App;
This library uses type definitions from @tracktor/types-treege
FAQs
A React library to consume easily form generated from Tree
The npm package treege-consumer receives a total of 52 weekly downloads. As such, treege-consumer popularity was classified as not popular.
We found that treege-consumer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.