Amos Framework

1.13.2 · active · verified Tue Apr 21

Amos Framework is a UI component library for JavaScript and TypeScript applications, providing a comprehensive collection of pre-built components, utilities, and tools. Currently at version 1.13.2, it offers a wide array of UI elements such as Button, Input, Form, Layout, and various utility functions like `message` and `Toast`. A key differentiator is its application-specific licensing mechanism, which mandates either a `license.dat` file or global configuration via `window.__amos__license__`. It supports modular, on-demand loading of components through a custom Babel plugin for optimized bundling. The framework emphasizes specific integration patterns for webpack (e.g., configuring externals) and custom Babel setups, making it less of a plug-and-play solution than some alternatives due to its explicit license management and toolkit-driven modularity. Its release cadence is not explicitly stated but appears stable, with updates reflected in its versioning.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing and using core Amos Framework UI components (Button, Input, Form) and the message utility, including basic state management and the required development license initialization.

import React from 'react';
import ReactDOM from 'react-dom/client';
import { Button, Input, message, Form, Layout, Row, Col } from 'amos-framework';
// Ensure framework styles are loaded. Example (actual path may vary based on build):
// import 'amos-framework/dist/amosframework.min.css';

// IMPORTANT: Simulate license setup for development. 
// For production, follow the official licensing guide.
// This can be a string key or an object based on your license type.
window.__amos__license__ = 'test'; // Quick start development license

const App = () => {
  const [inputValue, setInputValue] = React.useState('');

  const handleClick = () => {
    message.info('Button clicked! Input: ' + inputValue);
  };

  const handleSubmit = (e) => {
    e.preventDefault();
    message.success(`Form submitted with value: ${inputValue}`);
  };

  return (
    <Layout style={{ minHeight: '100vh', padding: '20px' }}>
      <Row justify="center" align="middle">
        <Col span={12} style={{ maxWidth: '600px', width: '100%' }}>
          <h1>Amos Framework Basic Usage</h1>
          <Form onSubmit={handleSubmit} style={{ marginBottom: '20px' }}>
            <Input
              value={inputValue}
              onChange={(e) => setInputValue(e.target.value)}
              placeholder="Enter some text..."
              style={{ width: '100%', marginBottom: '10px' }}
            />
            <Button type="primary" onClick={handleClick}>
              Show Message
            </Button>
            <Button type="submit" style={{ marginLeft: '10px' }}>
              Submit Form
            </Button>
          </Form>
          <p>
            This simple application demonstrates how to import and utilize core Amos Framework UI components like `Button`, `Input`, `Form`, `Layout`, and the `message` utility. It also highlights the crucial step of initializing the framework's license for local development, which is a mandatory requirement. For a full setup, ensure React and ReactDOM are available, and the framework's CSS is properly loaded into your project.
          </p>
        </Col>
      </Row>
    </Layout>
  );
};

const rootElement = document.getElementById('root');
if (rootElement) {
  const root = ReactDOM.createRoot(rootElement);
  root.render(<App />);
} else {
  console.error("Root element 'root' not found. Please add <div id='root'></div> to your HTML.");
}

view raw JSON →