NativeUI

NativeUI is a CSS and JavaScript library that adheres to the KISS principle and focuses on utilizing standard features provided by browsers, which are most optimized for each specific platform, and therefore provide the best performance and user experience. The library ensures cross-browser behavior and styling of built-in browser elements of user interface and text formatting, adding commonly used user interface elements such as modal windows, image viewer, menus, tabs, form messages, etc. It also contains some useful JavaScript functions for development, such as request() and getFormData().

Features

  • A "graceful degradation" approach is used, where modern CSS and JS features are used wherever possible, and if they are not supported by the browser, functionality and appearance are preserved as much as possible. For example, if the browser doesn't support linear-gradient, a single-color background is used, and the drop-down menu still works with JavaScript disabled, including the drop-down delay on hover, which is implemented on CSS.
  • Support for legacy browsers up to IE 9.
  • User selectable light and dark color schemes.
  • Interface elements, such as menus, have responsive design to make the interface convenient to use with any viewport resolution.
  • All sizes are specified in em. This means that the scale of elements depends on font size and is inherited from parent elements.
  • Supports all formatting elements used in Markdown.

Questions and answers

How to use the library?

Load the js-cookie library if you want to be able to save a user-selected color scheme. You can download it here, or with npm: npm i js-cookie. To support older browsers, you can download and link polyfills.js. Link all the necessary files using the code:

<link type="text/css" href="css/nativeui.css" rel="stylesheet" />
<script type="text/javascript" src="js/js-cookie.js"></script>
<script type="text/javascript" src="js/nativeui.js"></script>

Then call app.init(); from your JS code. If the application is not a single-page application, declare a variable appURI before loading the library as follows: <script type="text/javascript">app = {"appURI": "/app-root-path/"}</script>.

How is this library better than existing solutions such as Bootstrap?
About the same as the C language is better than Java. That is, the comparison is inherently incorrect. It's not better/worse, but for those who prefer more low-level web development, using the built in browser interface elements and using the browser's JavaScript APIs directly.

NativeUI — CSS и JavaScript библиотека, сделанная в соответствии с принципом KISS и ориентированная на использование стандартных возможностей, предоставляемых браузерами, которые наиболее оптимизированы под каждую конкретную платформу, а значит обеспечивают наилучшую производительность и удобство для пользователя. Библиотека обеспечивает кроссбраузерное поведение и стилизацию встроенных в браузер элементов пользовательского интерфейса и форматирования текста, добавляет часто используемые элементы, такие, как модальные окна, просмотрщик изображений, меню, вкладки, сообщения в формах и т. д. Также содержит некоторые полезные в разработке JavaScript-функции, например request() и getFormData().

Особенности

  • Используется подход «graceful degradation», при котором по возможности используются современные возможности CSS и JS, а если они не поддерживаются браузером, то функциональность и внешний вид сохраняются настолько, насколько это возможно. Например, если браузер не поддерживает linear-gradient, то используется одноцветный фон, а выпадающее меню сохраняет работоспособность с отключенным JavaScript, включая задержку выпадания при наведении, которая реализована на CSS.
  • Поддержка старых браузеров вплоть до IE 9.
  • Доступны светлая и темная цветовые схемы с возможностью их выбора пользователем.
  • Элементы интерфейса, такие, как меню, имеют адаптивный дизайн (responsive design), обеспечивающий удобное использование интерфейса при любом разрешении viewport'а.
  • Все размеры указаны в em. Это значит, что масштаб элементов зависит от размера шрифта и наследуется от родительских элементов.
  • Поддерживаются все элементы форматирования, используемые в Markdown.

Вопросы и ответы

Как использовать библиотеку?

Подключите библиотеку js-cookie, если вы хотите иметь возможность сохранения выбранной пользователем цветовой схемы. Скачать её можно здесь, либо с помощью npm: npm i js-cookie. Для поддержки старых браузеров вы можете скачать и подключить polyfills.js. Подключите все необходимые файлы с помощью кода:

<link type="text/css" href="css/nativeui.css" rel="stylesheet" />
<script type="text/javascript" src="js/js-cookie.js"></script>
<script type="text/javascript" src="js/nativeui.js"></script>

Затем вызовите app.init(); из вашего JS-кода. Если приложение не является одностраничным, объявите переменную appURI перед загрузкой библиотеки следующим образом: <script type="text/javascript">app = {"appURI": "/app-root-path/"}</script>.

Чем эта библиотека лучше существующих решений, таких, как Bootstrap?
Примерно тем же, чем язык Си лучше, чем Java. То есть, сравнение изначально некорректное. Она не лучше/хуже, а для тех, кто предпочитает более низкоуровневую веб-разработку с использованием встроенных в браузер элементов интерфейса и использованием JavaScript API браузера напрямую.

Download

v1.3.0 (2024-11-11)

Compressed Uncompressed
CSS Download uncompressed CSS
JS Download uncompressed JS
Demo

H1 header

H2 header

H3 header

H4 header

H5 header
H6 header

Emphasis

This is bold text

This is italic text

Combined emphasis with bold and italic text

Strikethrough text

Subscript / Superscript

<mark>

Marked text

<ins>

Inserted text

Abbreviations

This is HTML abbreviation example.

Keyboard Input

To reboot your computer, press ctrl+alt+del.

Blockquotes

Quote text

Text of the nested quote

Text of the another nested quote

Horizontal rules




Lists

Ordered list

  1. First ordered list item
  2. Another item
    • Unordered sub-list.
  3. Yet another item
    1. Ordered sub-list
  4. And yet another item.

    You can have properly indented paragraphs within list items.

Start numbering with offset

  1. foo
  2. bar

Unordered list

Lists with multiple levels of nesting

  1. foo
    1. bar
      1. baz
        1. faz
  2. foo2 (paragraph)

  1. foo (paragraph)

    • bar
      1. baz
        • faz

Code

Inline code

// Some comments
line 1 of code
line 2 of code
line 3 of code
var foo = function (bar) {
	return bar++;
};
console.log(foo(5));

Tables

Right aligned column

Option Description
data path to data files to supply the data that will be passed into templates.
engine engine to be used for processing templates. Handlebars is the default.
ext extension to be used for dest files.

Sortable

Mass (1024 kg) Diameter (km) Density (kg/m3) Gravity (m/s2) Escape Velocity (km/s) Rotation Period (hours) Length of Day (hours) Distance from Sun (106 km) Perihelion (106 km) Aphelion (106 km) Orbital Period (days) Orbital Velocity (km/s) Orbital Inclination (degrees) Orbital Eccentricity Obliquity to Orbit (degrees) Mean Temperature (C) Surface Pressure (bars) Number of Moons Ring System? Global Magnetic Field?
Mercury 0.330 4879 5429 3.7 4.3 1407.6 4222.6 57.9 46.0 69.8 88.0 47.4 7.0 0.206 0.034 167 0 0 No Yes
Venus 4.87 12.104 5243 8.9 10.4 -5832.5 2802.0 108.2 107.5 108.9 224.7 35.0 3.4 0.007 177.4 464 92 0 No No
Earth 5.97 12.756 5514 9.8 11.2 23.9 24.0 149.6 147.1 152.1 365.2 29.8 0.0 0.017 23.4 15 1 1 No Yes
Mars 0.642 6792 3934 3.7 5.0 24.6 24.7 228.0 206.7 249.3 687.0 24.1 1.8 0.094 25.2 -65 0.01 2 No No
Jupiter 1898 142.984 1326 23.1 59.5 9.9 9.9 778.5 740.6 816.4 4331 13.1 1.3 0.049 3.1 -110 Unknown 79 Yes Yes
Saturn 568 120.536 687 9.0 35.5 10.7 10.7 1432.0 1357.6 1506.5 10.747 9.7 2.5 0.052 26.7 -140 Unknown 82 Yes Yes
Uranus 86.8 51.118 1270 8.7 21.3 -17.2 17.2 2867.0 2732.7 3001.4 30.589 6.8 0.8 0.047 97.8 -195 Unknown 27 Yes Yes
Neptune 102 49.528 1638 11.0 23.5 16.1 16.1 4515.0 4471.1 4558.9 59.800 5.4 1.8 0.010 28.3 -200 Unknown 14 Yes Yes
Pluto 0.0130 2376 1850 0.7 1.3 -153.3 153.3 5906.4 4436.8 7375.9 90.560 4.7 17.2 0.244 122.5 -225 0.00001 5 No Unknown

Links

Link text.

Link with title.

Visited link.

Footnote 1 link1.

Footnote 2 link2.

Inline footnote3 definition.

Duplicated footnote reference2:1.

Images

Cartman 1
Eric Theodore Cartman

Cartman 2

Alt text (unloaded image)

Definition lists

Term 1

Definition 1 with lazy continuation.

Term 2 with inline markup

Definition 2

{ some code, part of definition 2 }

Third paragraph of definition 2.

Compact style:

Term 1
Definition 1
Term 2
Definition 2a
Definition 2b

Details

More info… Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Modal window

Modal viewer

NameGroup
sunrise-glow.svggroup1
folder-icon.pnggroup2
1.jpggroup2
2.jpggroup2
3.jpggroup2
4.jpggroup2
5.jpggroup2
6.jpggroup2
7.jpggroup2
8.jpggroup2
9.jpggroup2
10.jpggroup2

UI elements

Elementenableddisabled
input[type=text]
input[type=password]
textarea
select
select > optgroup
select[size]
select[multiple]
select[multiple] > optgroup
input[type=file]
label > input[type=radio]
label > input[type=checkbox]
input[type=submit].primary
input[type=submit]
input[type=reset].negative
input[type=reset]
input[type=button]
button
a.button Button Button
fieldset, .form-msg
Legend
The username is available for registration
The username must begin with a latin letter and can contain the characters a-z, 0-9, "_" and "-"
Radio:
There are incorrectly filled fields
HTML5 elements
input[type=number]
input[type=email]
input[type=url]
input[type=tel]
input[type=search]
input[type=date]
input[type=datetime]
input[type=datetime-local]
input[type=month]
input[type=week]
input[type=time]
input[type=color]
input[type=range]
input[list=datalist]
keygen (deprecated)
output 123 123
Tabs
.tabs.scrollable
The majestic eagle soared high above the mountains, its powerful wings beating against the wind.
From its lofty perch, it surveyed the vast expanse of wilderness below, searching for its next meal.
Suddenly, it spotted a darting movement in the brush and swooped down with lightning speed.
Its sharp talons clasped tightly around the unsuspecting prey, and with a fierce cry, the eagle took to the skies once more, victorious in its hunt.
The sun beat down mercilessly on the dry desert sands, casting long shadows across the arid landscape.
A lone camel grazed on a patch of withered shrubs, its eyes squinted against the bright light.
In the distance, a caravan of nomads slowly made their way across the dunes, their silhouettes a mere blur against the vast expanse of sand.
All was quiet, save for the soft rustling of the desert wind and the occasional grunt of the camel as it lazily chewed its cud.
.tabs.vertical
The dense jungle was alive with the sounds of exotic birds and chattering monkeys.
The thick foliage made it difficult to see more than a few feet in front of you.
A small river snaked its way through the heart of the jungle, its gentle current occasionally broken by a splash as a fish jumped out of the water.
High above the canopy, the sun shone down, casting shimmering beams of light through the leaves and illuminating the vibrant colors of the jungle.
The icy winds of the Arctic whipped relentlessly against the reinforced metal walls of the research station.
Inside, the scientists worked diligently, pouring over data and conducting experiments in a quest to understand this harsh and unforgiving environment.
The northern lights danced in an array of colors outside the windows, casting an otherworldly glow across the frozen landscape.
Despite the bitter cold and isolation, the team felt a sense of excitement and wonder as they probed deeper into the mysteries of the Arctic.