Eli Yukelzon
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Component systems comparison # Systems compared * Grommet by HP - https://v2.grommet.io * Fabric by MS - https://developer.microsoft.com/en-us/fabric#/controls/web * Ant by Alibaba - https://ant.design/components/ * Atlaskit by Atlassian - https://atlaskit.atlassian.com/packages * Polaris by Shopify - https://polaris.shopify.com/components/get-started#navigation * BaseUI by Uber - https://baseweb.design/ 1. All these libraries are written in Typescript, thus providing good auto-complete support in the IDEs 2. Each library is distributed on the web with an interactive style guide. We'll be using [Storybook](https://storybook.js.org/) 3. They all provide accessibility properties for components, like accessibilityLabel, ariaControls, ariaExpanded, ariaPressed etc 4. Each component is described with "Do"s and "Don't"s 5. Libraries differ in the way the handle 'mega' components (same component doing different things) # Components compared * Button * Table * Modal * Grid * Text Input ## Button ### BaseUI ```jsx <Button shape={SHAPE.round} startEnhancer={() => <ArrowRight size={24} />} disabled size={SIZE.compact}>Compact size</Button> ``` ### Grommet ```jsx <Button icon={<Icons.Edit />} label="Edit" disabled primary onClick={() => {}} /> ``` ### Ant ```jsx <Button type="danger" disabled block icon="cloud"> Danger </Button> ``` ### Fabric ```jsx <DefaultButton data-automation-id="test" disabled={disabled} checked={checked} iconProps={{ iconName: 'Upload' }} text="Create account" onClick={alertClicked} split={true} aria-roledescription={'split button'} /> ``` ### Polaris ```jsx <Button loading={false} disabled icon={<Icon source={CirclePlusMinor} />}>Save product</Button> ``` ### Atlaskit ```jsx <Button isLoading={showLoadingState} appearance="primary" isDisabled={true}> Disabled </Button> ``` ### Conclusions 1. Fabric is the only library using the 'mega' component approach by combining functionality of dropdown, toggle, etc 2. Ant and Fabric use a bad style of providing icons via strings. Other libraries have a separate component for each Icon, thus allowing proper code splitting and tree shaking 3. All libraries support 'type' prop to create basic buttons (primary/danger/etc) without creating new Button components per case 4. Standard html5 attributes are handled (disabled, checked, htmlType) 5. Accessibility is handled by an additional property for screen readers 6. Buttons support 'loading' state ## Text field ### BaseUI ```jsx <StatefulInput placeholder="Input in an error state" error disabled /> ``` ### Polaris ```jsx <TextField label="Account email" type="email" value={this.state.value} onChange={this.handleChange} helpText="We’ll use this address if we need to contact you about your account." /> ``` ### Grommet ```jsx <FormField label="Field label"> <TextInput placeholder="type here" /> </FormField> ``` ### Ant ```jsx <Form.Item label="Password" hasFeedback> <Input style={{ width: '20%' }} defaultValue="0571" /> </Form.Item> ``` ### Fabric ```jsx <TextField label="Disabled with placeholder" disabled placeholder="I am disabled" /> ``` ### Atlaskit ```jsx <label htmlFor="disabled">Disabled</label> <Textfield name="disabled" isDisabled defaultValue="can't touch this..." /> ``` ### Conclusions 1. Fabric and Polaris are combining both label and text input 2. Atlaskit uses standard HTML5 label and 'htmlFor' which is not very generic. Other libraries have a separate label wrapper 3. Masked input is handled in all libraries by a separate component ## Table Fabric: No table component ### BaseUI ```jsx <StyledTable> <StyledHead> <SortableHeadCell title="Name" direction={this.state.nameDirection} onSort={() => this.handleSort('name', this.state.nameDirection) } /> <SortableHeadCell title="Age" direction={this.state.ageDirection} onSort={() => this.handleSort('age', this.state.ageDirection) } /> </StyledHead> <StyledBody> {this.getSortedData().map((row, index) => ( <StyledRow key={index}> {row.map((cell, cellIndex) => ( <StyledCell key={cellIndex}>{cell}</StyledCell> ))} </StyledRow> ))} </StyledBody> </StyledTable> ``` ### Atlaskit ```jsx <DynamicTable caption={caption} head={head} rows={rows} rowsPerPage={10} defaultPage={1} loadingSpinnerSize="large" isLoading={false} isFixedSize defaultSortKey="term" defaultSortOrder="ASC" onSort={() => console.log('onSort')} onSetPage={() => console.log('onSetPage')} /> ``` ### Ant ```jsx <Table dataSource={data}> <ColumnGroup title="Name"> <Column title="First Name" dataIndex="firstName" key="firstName" /> <Column title="Last Name" dataIndex="lastName" key="lastName" /> </ColumnGroup> <Column title="Age" dataIndex="age" key="age" /> <Column title="Address" dataIndex="address" key="address" /> <Column title="Tags" dataIndex="tags" key="tags" render={tags => ( <span> {tags.map(tag => ( <Tag color="blue" key={tag}> {tag} </Tag> ))} </span> )} /> <Column title="Action" key="action" render={(text, record) => ( <span> <a href="javascript:;">Invite {record.lastName}</a> <Divider type="vertical" /> <a href="javascript:;">Delete</a> </span> )} /> </Table> ``` ### Polaris ```jsx <DataTable columnContentTypes={[ 'text', 'numeric', 'numeric', 'numeric', 'numeric', ]} headings={[ 'Product', 'Price', 'SKU Number', 'Net quantity', 'Net sales', ]} rows={rows} totals={['', '', '', 255, '$155,830.00']} /> ``` ### Grommet ```jsx <Table> <TableHeader> <TableRow> <TableCell scope="col" border="bottom"> Name </TableCell> <TableCell scope="col" border="bottom"> Flavor </TableCell> </TableRow> </TableHeader> <TableBody> <TableRow> <TableCell scope="row"> <strong>Eric</strong> </TableCell> <TableCell>Coconut</TableCell> </TableRow> <TableRow> <TableCell scope="row"> <strong>Chris</strong> </TableCell> <TableCell>Watermelon</TableCell> </TableRow> </TableBody> </Table> ``` ### Conclusions 1. Grommet uses JSX approach (you are expected to write `items.map(item => <TableRow ...>))` and uses same TableCell for both header and content. Not flexible 2. Ant supports both JSX approach and DataSource approach 3. Atlaskit, BaseUI and Ant support custom cell rendering using 'render' prop 4. Datasource approach is very appealing, since it separates data from rendering. It also allows easy table creation by supplying 'dataIndex' - the name of the field to use from the row object, so the mapping is automatic 5. Pagination is provided as a separate component, not part of the Table 6. Sorting and Filtering is supported by all except Grommet 7. All except Grommet support 'loading' state for the table ## Modal ### BaseUI ```jsx <ModalStateContainer> {({open, close, isOpen}) => ( <React.Fragment> <Button onClick={open}>Open Modal</Button> <Modal onClose={close} isOpen={isOpen}> <ModalHeader>Hello world</ModalHeader> <ModalBody> Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla ornare faucibus ex, non facilisis nisl. Maecenas aliquet mauris ut tempus. </ModalBody> <ModalFooter> <ModalButton onClick={close}>Cancel</ModalButton> <ModalButton onClick={close}>Okay</ModalButton> </ModalFooter> </Modal> </React.Fragment> )} </ModalStateContainer> ``` ### Grommet ```jsx {show && <Layer onEsc={() => setShow(false)} onClickOutside={() => setShow(false)} > <Button label="close" onClick={() => setShow(false)} /> </Layer>} ``` ### Atlaskit ```jsx <ModalDialog key={name} actions={ ['footer', 'both'].includes(name) ? actions : undefined } components={{ Header: name === 'custom header' ? Header : undefined, Body: name === 'custom body' ? Body : undefined, Footer: name === 'custom footer' ? Footer : undefined, Container: 'div', }} heading={ ['header', 'both'].includes(name) ? `Modal: ${name}` : undefined } onClose={this.close} width={name === 'custom header' ? 300 : undefined} {...this.props} > <Lorem count="5" /> </ModalDialog> ``` ### Polaris ```jsx <Modal open={active} onClose={this.handleChange} title="Reach more shoppers with Instagram product tags" primaryAction={{ content: 'Add Instagram', onAction: this.handleChange, }} secondaryActions={[ { content: 'Learn more', onAction: this.handleChange, }, ]} > <Modal.Section> <TextContainer> <p> Use Instagram posts to share your products with millions of people. Let shoppers buy from your store without leaving Instagram. </p> </TextContainer> </Modal.Section> </Modal> ``` ### Ant ```jsx <Modal title="Basic Modal" visible={this.state.visible} onOk={this.handleOk} onCancel={this.handleCancel} > <p>Some contents...</p> <p>Some contents...</p> <p>Some contents...</p> </Modal> ``` ### Fabric ```jsx <Modal titleAriaId={this._titleId} subtitleAriaId={this._subtitleId} isOpen={this.state.showModal} onDismiss={this._closeModal} isBlocking={false} containerClassName={styles.container} dragOptions={this.state.isDraggable ? this._dragOptions : undefined} > <div className={styles.header}> <span id={this._titleId}>Lorem Ipsum</span> </div> <div id={this._subtitleId} className={styles.body}> <DefaultButton onClick={this._closeModal} text="Close" /> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas lorem nulla, malesuada ut sagittis sit amet, vulputate in leo. Maecenas vulputate congue sapien eu tincidunt. Etiam eu sem turpis. Fusce tempor sagittis nunc, ut interdum ipsum </p> </div> </Modal> ``` ### Conclusions 1. All libraries except Grommet provide a feature-rich component that handles the rendering of the Title, Close Button and bottom actions 2. Fabric a uses 'mega' component approach, while Atlaskit, BaseUI and Polaris use composition of supported Modal parts (Header, Footer, Body, Actions, etc) 3. Ant and Polaris support 'loading' state for the dialog (content is invisible and spinner or skeleton is shown) 4. Customization is provided by className in most libraries (except Shopify, since it has a consistent non-modifiable style) ## Layout primitives ### BaseUI ```jsx <Block display="grid" gridTemplateColumns="repeat(3,1fr)" justifyItems="center" gridGap="scale1000" > <Inner>1</Inner> <Inner>2</Inner> <Inner>3</Inner> <Inner>4</Inner> <Inner>5</Inner> <Inner>6</Inner> </Block> <FlexGrid flexGridColumnCount={3} flexGridColumnGap="scale800" flexGridRowGap="scale800" > <FlexGridItem {...itemProps}>1</FlexGridItem> <FlexGridItem {...itemProps}>2</FlexGridItem> <FlexGridItem {...itemProps}>3</FlexGridItem> <FlexGridItem {...itemProps}>4</FlexGridItem> <FlexGridItem {...itemProps}>5</FlexGridItem> <FlexGridItem {...itemProps}>6</FlexGridItem> </FlexGrid> ``` ### Ant ```jsx <Row> <Col span={8}>col-8</Col> <Col span={8} offset={8}> col-8 </Col> </Row> ``` ### Grommet ```jsx <Grid rows={['xxsmall', 'xsmall']} columns={['xsmall', 'small']} gap="small" areas={[ { name: 'header', start: [0, 0], end: [1, 0] }, { name: 'nav', start: [0, 1], end: [0, 1] }, { name: 'main', start: [1, 1], end: [1, 1] }, ]} > <Box gridArea="header" background="brand" /> <Box gridArea="nav" background="light-5" /> <Box gridArea="main" background="light-2" /> </Grid> <Stack anchor="top-right"> <Icons.Notification size="large" /> <Box background="brand" pad={{ horizontal: 'xsmall' }} round > <Text>8</Text> </Box> </Stack> ``` ### Atlaskit no components ### Polaris ```jsx <Stack alignment="center"> <Heading> Order <br /> #1136 <br /> was paid </Heading> <Badge>Paid</Badge> <Badge>Fulfilled</Badge> </Stack> ``` ### Fabric ```jsx <Stack styles={stackStyles} tokens={itemAlignmentsStackTokens}> <Stack.Item align="auto" styles={stackItemStyles}> <span>Auto-aligned item</span> </Stack.Item> <Stack.Item align="stretch" styles={stackItemStyles}> <span>Stretch-aligned item</span> </Stack.Item> <Stack.Item align="baseline" styles={stackItemStyles}> <span>Baseline-aligned item</span> </Stack.Item> <Stack.Item align="start" styles={stackItemStyles}> <span>Start-aligned item</span> </Stack.Item> <Stack.Item align="center" styles={stackItemStyles}> <span>Center-aligned item</span> </Stack.Item> <Stack.Item align="end" styles={stackItemStyles}> <span>End-aligned item</span> </Stack.Item> </Stack> ``` ### Conclusions 1. All libraries except Atlaskit have basic building blocks for laying out the components. Either Stack or Grid 2. Basic components are responsive and receive span, offset, etc to support different resolutions

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully